[master] 774d8df Attempt to stabilize test g00005 by making the test do what it purports to say on the tin, and by removing the quantum-test it trips over.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Apr 10 11:07:11 UTC 2018
commit 774d8df5a8bc43e05a2ad336b50f72cbf2923b25
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Apr 10 11:05:30 2018 +0000
Attempt to stabilize test g00005 by making the test do what it
purports to say on the tin, and by removing the quantum-test
it trips over.
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index aee17d3..7cb317c 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -315,21 +315,18 @@ vdp_gunzip(struct req *req, enum vdp_action act, void **priv,
http_Unset(req->resp, H_Content_Encoding);
req->resp_len = -1;
- if (req->objcore->boc != NULL)
- return (0); /* No idea about length (yet) */
p = ObjGetAttr(req->wrk, req->objcore, OA_GZIPBITS, &dl);
- if (p == NULL || dl != 32)
- return (0); /* No OA_GZIPBITS yet */
-
- u = vbe64dec(p + 24);
- /*
- * If the size is non-zero AND we are the top
- * VDP (ie: no ESI), we know what size the output will be.
- */
- if (u != 0 && VTAILQ_FIRST(&req->vdc->vdp)->vdp == &VDP_gunzip)
- req->resp_len = u;
-
+ if (p != NULL || dl == 32) {
+ u = vbe64dec(p + 24);
+ /*
+ * If the size is non-zero AND we are the top VDP
+ * (ie: no ESI), we know what size the output will be.
+ */
+ if (u != 0 &&
+ VTAILQ_FIRST(&req->vdc->vdp)->vdp == &VDP_gunzip)
+ req->resp_len = u;
+ }
return (0);
}
diff --git a/bin/varnishtest/tests/g00005.vtc b/bin/varnishtest/tests/g00005.vtc
index 9eacb10..24b3b60 100644
--- a/bin/varnishtest/tests/g00005.vtc
+++ b/bin/varnishtest/tests/g00005.vtc
@@ -3,7 +3,17 @@ varnishtest "test gunzip for client + Range"
server s1 -repeat 3 {
rxreq
expect req.http.accept-encoding == "gzip"
- txresp -gzipbody FOOBARBARF
+ txresp -nolen -hdr "Transfer-encoding: chunked" \
+ -hdr "Content-encoding: gzip"
+ delay 1
+ # Compressed "FOOBARBARF"
+ sendhex {
+ 31 43 0d 0a
+ 1f 8b 08 00 75 96 cc 5a 02 03 73 f3 f7 77 72 0c
+ 02 22 37 00 06 8e 8c 83 0a 00 00 00
+ 0d 0a
+ 30 0d 0a 0d 0a
+ }
} -start
varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend {
@@ -21,33 +31,49 @@ client c1 {
expect resp.status == 200
expect resp.bodylen == "10"
expect resp.http.content-encoding == <undef>
+} -run
+
+varnish v1 -vsl_catchup
+client c1 {
txreq -hdr "Accept-encoding: gzip;q=0.1"
rxresp
expect resp.http.content-encoding == "gzip"
gunzip
expect resp.bodylen == "10"
+} -run
- # This delay attempts to ensure that the busyobj
- # is completed before we attempt the range request
- delay 1
+varnish v1 -vsl_catchup
+
+# This delay attempts to ensure that the busyobj
+# is completed before we attempt the range request
+delay 2
+client c1 {
txreq -hdr "Range: bytes=3-5"
rxresp
expect resp.status == 206
expect resp.http.content-encoding == "<undef>"
expect resp.bodylen == "3"
expect resp.body == "BAR"
+} -run
+varnish v1 -vsl_catchup
+
+client c1 {
txreq -url "/nostreamcachemiss" -hdr "Range: bytes=3-5"
rxresp
expect resp.status == 206
expect resp.http.content-encoding == "<undef>"
expect resp.bodylen == "3"
expect resp.body == "BAR"
+} -run
+
+varnish v1 -vsl_catchup
- # simple cache miss no gunzip
- txreq -url "/2" -hdr "Range: bytes=3-5" -hdr "Accept-Encoding: gzip"
+client c1 {
+ # simple cache miss, no stream, no gunzip
+ txreq -url "/nostream2" -hdr "Range: bytes=3-5" -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 206
expect resp.http.content-encoding == "gzip"
More information about the varnish-commit
mailing list