handler: only send content-length header when not using chunked transfer
authorFelix Fietkau <nbd@openwrt.org>
Sun, 8 Nov 2015 19:22:18 +0000 (20:22 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 8 Nov 2015 19:22:18 +0000 (20:22 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
handler.c

index a578a32ff738b59732195af40b050ebabec2ea42..8e8b9c8c3fc832522d2244933b750af1eb366134 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -61,7 +61,8 @@ handle_redirect(struct json_script_ctx *ctx, struct blob_attr *data)
        }
 
        uh_http_header(cl, code, status);
-       ustream_printf(cl->us, "Content-Length: 0\r\n");
+       if (!uh_use_chunked(cl))
+               ustream_printf(cl->us, "Content-Length: 0\r\n");
        ustream_printf(cl->us, "Location: %s\r\n\r\n",
                       blobmsg_get_string(tb[0]));
        uh_request_done(cl);