Commit 72a6b8bc authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r5217: Fix a cornercase of chunked encoding and malloc stevedore

Don't try to trim a storage segment we filled completely.

Fixes: #776



git-svn-id: http://www.varnish-cache.org/svn/branches/2.1@5363 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent dd2c6164
......@@ -211,7 +211,7 @@ fetch_chunked(struct sess *sp, struct http_conn *htc)
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);
}
......@@ -276,7 +276,7 @@ fetch_eof(struct sess *sp, struct http_conn *htc)
if (st->len == 0) {
VTAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
} else
} else
STV_trim(st, st->len);
return (1);
......
# $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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment