summaryrefslogtreecommitdiff
path: root/src/c/http.c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2013-11-27 15:28:55 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2013-11-27 15:28:55 -0500
commitee27f397f8ae80bfdb230f8c06a2025289d0db56 (patch)
treecb66e67b322fe577e3096fbb07172f30b06ab0b3 /src/c/http.c
parentcfdef46268b002d09a124dca9fce7d6a8c33d86e (diff)
Add Connection and Content-length headers to raw HTTP responses
Diffstat (limited to 'src/c/http.c')
-rw-r--r--src/c/http.c9
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);