[3.0] 4ae3ffc Stop handling after gzip object end.
Lasse Karstensen
lkarsten at varnish-software.com
Mon Jan 27 12:53:37 CET 2014
commit 4ae3ffc3ab7cd358fa626caf3a9fab55f3bda22d
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date: Fri Jan 3 15:58:47 2014 +0100
Stop handling after gzip object end.
Junk after gzip body end would lead to a spinning
thread.
Fixes: #1086
diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index b870aa7..12ba133 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -289,6 +289,8 @@ vfp_esi_bytes_gg(struct sess *sp, struct http_conn *htc, size_t bytes)
vef->bufp, dl);
vef->npend += dl;
}
+ if (i == VGZ_END)
+ break;
} while (!VGZ_IbufEmpty(sp->wrk->vgz_rx));
}
return (1);
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 07bdcac..96a430a 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -378,6 +378,9 @@ VGZ_WrwGunzip(const struct sess *sp, struct vgz *vg, const void *ibuf,
/* XXX: VSL ? */
return (-1);
}
+ else if (i == VGZ_END) {
+ break;
+ }
if (obufl == *obufp || i == VGZ_STUCK) {
sp->wrk->acct_tmp.bodybytes += *obufp;
(void)WRW_Write(sp->wrk, obuf, *obufp);
diff --git a/bin/varnishtest/tests/r01086.vtc b/bin/varnishtest/tests/r01086.vtc
new file mode 100644
index 0000000..0fabfde
--- /dev/null
+++ b/bin/varnishtest/tests/r01086.vtc
@@ -0,0 +1,41 @@
+varnishtest "#1086 junk after gzip from backend and streaming enabled"
+
+server s1 {
+ rxreq
+ txresp -nolen \
+ -hdr "Content-Encoding: gzip" \
+ -hdr "Transfer-Encoding: Chunked"
+ send "14\r\n"
+ # An empty gzip file:
+ sendhex "1f8b"
+ sendhex "08"
+ sendhex "00"
+ sendhex "00000000"
+ sendhex "00"
+ sendhex "03"
+ sendhex "0300"
+ sendhex "00000000"
+ sendhex "00000000"
+ send "\r\n"
+
+ chunked "FOOBAR"
+
+ chunkedlen 0
+
+} -start
+
+varnish v1 -arg {-p diag_bitmap=0x00010000} -vcl+backend {
+ sub vcl_fetch {
+ set beresp.do_stream = true;
+ }
+}
+
+varnish v1 -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 200
+ expect resp.bodylen == 0
+} -run
+
More information about the varnish-commit
mailing list