r5217 - in trunk/varnish-cache/bin: varnishd varnishtest/tests
phk at varnish-cache.org
phk at varnish-cache.org
Wed Sep 15 21:01:42 CEST 2010
Author: phk
Date: 2010-09-15 21:01:42 +0200 (Wed, 15 Sep 2010)
New Revision: 5217
Added:
trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc
Modified:
trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Fix a cornercase of chunked encoding and malloc stevedore:
Don't try to trim a storage segment we filled completely.
Fixes: #776
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2010-09-15 19:00:29 UTC (rev 5216)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2010-09-15 19:01:42 UTC (rev 5217)
@@ -210,7 +210,7 @@
if (st != NULL && st->len == 0) {
VTAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
- } else if (st != NULL)
+ } else if (st != NULL && st->len < st->space)
STV_trim(st, st->len);
return (0);
}
@@ -275,7 +275,7 @@
if (st->len == 0) {
VTAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
- } else
+ } else
STV_trim(st, st->len);
return (1);
Added: trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc 2010-09-15 19:01:42 UTC (rev 5217)
@@ -0,0 +1,18 @@
+# $Id$
+
+test "Edge case of chunked encoding, trimming storage to length."
+
+server s1 {
+ rxreq
+ txresp -nolen -hdr "Transfer-encoding: chunked"
+ chunkedlen 4096
+} -start
+
+varnish v1 \
+ -arg "-p fetch_chunksize=4" \
+ -arg "-s malloc,1m" -vcl+backend { } -start
+
+client c1 {
+ txreq
+ rxresp
+} -run
More information about the varnish-commit
mailing list