diff options
author | 2013-11-27 15:28:55 -0500 | |
---|---|---|
committer | 2013-11-27 15:28:55 -0500 | |
commit | ee27f397f8ae80bfdb230f8c06a2025289d0db56 (patch) | |
tree | cb66e67b322fe577e3096fbb07172f30b06ab0b3 /src/c/http.c | |
parent | cfdef46268b002d09a124dca9fce7d6a8c33d86e (diff) |
Add Connection and Content-length headers to raw HTTP responses
Diffstat (limited to 'src/c/http.c')
-rw-r--r-- | src/c/http.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/c/http.c b/src/c/http.c index 48a042dc..ba9214c5 100644 --- a/src/c/http.c +++ b/src/c/http.c @@ -204,7 +204,14 @@ static void *worker(void *data) { on_success, on_failure, NULL, log_error, log_debug, sock, uw_really_send, close); - if (rr != KEEP_OPEN) uw_send(ctx, sock); + if (rr != KEEP_OPEN) { + char clen[100]; + + uw_write_header(ctx, "Connection: close\r\n"); + sprintf(clen, "Content-length: %d\r\n", uw_pagelen(ctx)); + uw_write_header(ctx, clen); + uw_send(ctx, sock); + } if (rr == SERVED || rr == FAILED) close(sock); |