varnish/varnish.fix_Content-Length_header.r5461.patch

47 lines
1.1 KiB
Diff
Raw Normal View History

Index: bin/varnishtest/tests/r00801.vtc
===================================================================
--- bin/varnishtest/tests/r00801.vtc (revisjon 0)
+++ bin/varnishtest/tests/r00801.vtc (revisjon 5461)
@@ -0,0 +1,24 @@
+# $Id$
+
+test "Regression test for duplicate content-length in pass"
+
+server s1 {
+ rxreq
+ txresp \
+ -hdr "Date: Mon, 25 Oct 2010 06:34:06 GMT" \
+ -hdr "Content-length: 10xx" \
+ -nolen -bodylen 10
+} -start
+
+
+varnish v1 -vcl+backend {
+ sub vcl_recv { return (pass); }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.http.content-length == "10"
+} -run
+
+
Index: bin/varnishd/cache_fetch.c
===================================================================
--- bin/varnishd/cache_fetch.c (revisjon 5460)
+++ bin/varnishd/cache_fetch.c (revisjon 5461)
@@ -552,9 +552,11 @@
assert(uu == sp->obj->len);
}
- if (mklen > 0)
+ if (mklen > 0) {
+ http_Unset(sp->obj->http, H_Content_Length);
http_PrintfHeader(sp->wrk, sp->fd, sp->obj->http,
"Content-Length: %u", sp->obj->len);
+ }
if (http_HdrIs(hp, H_Connection, "close"))
cls = 1;