Commit b0345c4b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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/trunk/varnish-cache@5217 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e3324238
......@@ -210,7 +210,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);
}
......@@ -275,7 +275,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