[6.0] 07e80a0f7 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.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:52:40 UTC 2018


commit 07e80a0f7f6f1bd6bb9461f82716c827af4a710e
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 aee17d3dd..7cb317c59 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 9eacb10b1..24b3b6071 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