Commit 41f7a356 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix an oversight when we closed #942: The exact same condition

can happen if we gunzip on fetch.
parent 36e9a06f
......@@ -516,6 +516,8 @@ vfp_gunzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
i = VGZ_Gunzip(vg, &dp, &dl);
if (i != VGZ_OK && i != VGZ_END)
return(VFP_Error(bo, "Gunzip data error"));
if (i == VGZ_END && !VGZ_IbufEmpty(vg))
return(VFP_Error(bo, "Junk after gzip data"));
VBO_extend(bo, dl);
}
assert(i == Z_OK || i == Z_STREAM_END);
......
varnishtest "#942 junk after gzip from backend"
server s1 {
server s1 -repeat 2 {
rxreq
txresp -nolen \
-hdr "Content-Encoding: gzip" \
-hdr "Connection: close" \
-hdr "Transfer-Encoding: Chunked"
send "14\r\n"
# An empty gzip file:
......@@ -21,13 +22,17 @@ server s1 {
chunked "FOOBAR"
chunkedlen 0
expect_close
accept
} -start
varnish v1 \
-vcl+backend {
sub vcl_backend_response {
set beresp.do_stream = false;
if (bereq.http.foo == "foo") {
set beresp.do_gunzip = true;
}
}
}
......@@ -35,7 +40,13 @@ varnish v1 -cliok "param.set debug +syncvsl"
varnish v1 -start
client c1 {
txreq
txreq -url /1
rxresp
expect resp.status == 503
} -run
client c1 {
txreq -url /2 -hdr "Foo: foo"
rxresp
expect resp.status == 503
} -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