Add Af-Trigger

This commit is contained in:
Kamil Trzcinski
2022-07-05 12:05:17 +02:00
parent 26d94709e3
commit 4eaa42f1ea
7 changed files with 49 additions and 9 deletions

View File

@ -16,7 +16,7 @@ static void http_write_response(
fprintf(stream, "HTTP/1.1 %s\r\n", status ? status : "200 OK");
fprintf(stream, "Content-Type: %s\r\n", content_type ? content_type : "text/plain");
if (content_length > 0)
fprintf(stream, "Content-Type: %d\r\n", content_length);
fprintf(stream, "Content-Length: %d\r\n", content_length);
fprintf(stream, "\r\n");
if (body) {
fwrite(body, 1, content_length, stream);
@ -41,6 +41,11 @@ void http_content(http_worker_t *worker, FILE *stream)
}
}
void http_200(FILE *stream, const char *data)
{
http_write_response(stream, "200 OK", NULL, data ? data : "Nothing here.\n", 0);
}
void http_404(FILE *stream, const char *data)
{
http_write_response(stream, "404 Not Found", NULL, data ? data : "Nothing here.\n", 0);