summaryrefslogtreecommitdiff
path: root/src/c/http.c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2013-12-12 10:24:38 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2013-12-12 10:24:38 -0500
commitfdeb6edadce0a9da274449ac1450e871e183734b (patch)
tree58dd68d97c0fec25702f9be73748da285c3c74be /src/c/http.c
parentbc4cdf7f4a995846125917ac0abb1a67bfd81fca (diff)
HTTP: avoid duplicate Content-length
Diffstat (limited to 'src/c/http.c')
-rw-r--r--src/c/http.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/c/http.c b/src/c/http.c
index d19ce350..ebe50bea 100644
--- a/src/c/http.c
+++ b/src/c/http.c
@@ -233,8 +233,6 @@ static void *worker(void *data) {
sock, uw_really_send, close);
if (rr != KEEP_OPEN) {
- char clen[100];
-
if (keepalive) {
char *connection = uw_Basis_requestHeader(ctx, "Connection");
@@ -244,8 +242,13 @@ static void *worker(void *data) {
if (!should_keepalive)
uw_write_header(ctx, "Connection: close\r\n");
- sprintf(clen, "Content-length: %d\r\n", uw_pagelen(ctx));
- uw_write_header(ctx, clen);
+ if (!uw_has_contentLength(ctx)) {
+ char clen[100];
+
+ sprintf(clen, "Content-length: %d\r\n", uw_pagelen(ctx));
+ uw_write_header(ctx, clen);
+ }
+
uw_send(ctx, sock);
}