r5461 - in trunk/varnish-cache/bin: varnishd varnishtest/tests
phk at varnish-cache.org
phk at varnish-cache.org
Mon Oct 25 10:37:54 CEST 2010
Author: phk
Date: 2010-10-25 10:37:54 +0200 (Mon, 25 Oct 2010)
New Revision: 5461
Added:
trunk/varnish-cache/bin/varnishtest/tests/r00801.vtc
Modified:
trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
On pass (from vcl_recv) we did not remove the backends Content-Length
header before adding our own.
We can not do this with the fetch filtering, because pass might send
HEAD requests to the backend.
XXX: It's arguable that the filtering stuff might be better done
inline than with a table.
Fixes: #801
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2010-10-25 07:54:06 UTC (rev 5460)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2010-10-25 08:37:54 UTC (rev 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;
Added: trunk/varnish-cache/bin/varnishtest/tests/r00801.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00801.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00801.vtc 2010-10-25 08:37:54 UTC (rev 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
+
+
More information about the varnish-commit
mailing list