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

diff --git a/file.c b/file.c
index 816df85256214756223628297a1cea04b71f9e3b..12aa130343b14e20334774875698be7e7a168aa1 100644 (file)
--- a/file.c
+++ b/file.c
@@ -235,7 +235,8 @@ uh_path_lookup(struct client *cl, const char *url)
           url with trailing slash appended */
        if (!slash) {
                uh_http_header(cl, 302, "Found");
-               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%s%s\r\n\r\n",
                                &path_phys[docroot_len],
                                p.query ? "?" : "",