[6.1] 913a92db4 Mark our extension to ZLib and #ifdef the code in varnishtest which reports stuff from it for debugging.

hermunn hermunn at varnish-software.com
Wed Oct 24 09:29:14 UTC 2018


commit 913a92db43cf8be2dd6c2fb54a07cb1b5f1bc4d6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 24 06:48:49 2018 +0000

    Mark our extension to ZLib and #ifdef the code in varnishtest which
    reports stuff from it for debugging.

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index d89a91a5a..952563b9f 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -771,6 +771,7 @@ cmd_http_gunzip(CMD_ARGS)
 	vtc_log(hp->vl, 3, "new bodylen %u", hp->bodyl);
 	vtc_dump(hp->vl, 4, "body", hp->body, hp->bodyl);
 	bprintf(hp->bodylen, "%u", hp->bodyl);
+#ifdef VGZ_EXTENSIONS
 	vtc_log(hp->vl, 4, "startbit = %ju %ju/%ju",
 	    (uintmax_t)vz.start_bit,
 	    (uintmax_t)vz.start_bit >> 3, (uintmax_t)vz.start_bit & 7);
@@ -780,6 +781,7 @@ cmd_http_gunzip(CMD_ARGS)
 	vtc_log(hp->vl, 4, "stopbit = %ju %ju/%ju",
 	    (uintmax_t)vz.stop_bit,
 	    (uintmax_t)vz.stop_bit >> 3, (uintmax_t)vz.stop_bit & 7);
+#endif
 	if (i != Z_STREAM_END)
 		vtc_log(hp->vl, hp->fatal,
 		    "Gunzip error = %d (%s) in:%jd out:%jd",
@@ -813,12 +815,13 @@ gzip_body(const struct http *hp, const char *txt, char **body, int *bodylen)
 	assert(Z_OK == deflateInit2(&vz,
 	    hp->gziplevel, Z_DEFLATED, 31, 9, Z_DEFAULT_STRATEGY));
 	assert(Z_STREAM_END == deflate(&vz, Z_FINISH));
+	*bodylen = vz.total_out;
+#ifdef VGZ_EXTENSIONS
 	i = vz.stop_bit & 7;
 	if (hp->gzipresidual >= 0 && hp->gzipresidual != i)
 		vtc_log(hp->vl, hp->fatal,
 		    "Wrong gzip residual got %d wanted %d",
 		    i, hp->gzipresidual);
-	*bodylen = vz.total_out;
 	vtc_log(hp->vl, 4, "startbit = %ju %ju/%ju",
 	    (uintmax_t)vz.start_bit,
 	    (uintmax_t)vz.start_bit >> 3, (uintmax_t)vz.start_bit & 7);
@@ -829,6 +832,7 @@ gzip_body(const struct http *hp, const char *txt, char **body, int *bodylen)
 	    (uintmax_t)vz.stop_bit,
 	    (uintmax_t)vz.stop_bit >> 3, (uintmax_t)vz.stop_bit & 7);
 	assert(Z_OK == deflateEnd(&vz));
+#endif
 }
 
 /**********************************************************************
diff --git a/lib/libvgz/vgz.h b/lib/libvgz/vgz.h
index 86831eeed..1bb81009d 100644
--- a/lib/libvgz/vgz.h
+++ b/lib/libvgz/vgz.h
@@ -104,6 +104,7 @@ typedef struct z_stream_s {
     uLong   adler;      /* Adler-32 or CRC-32 value of the uncompressed data */
     uLong   reserved;   /* reserved for future use */
 
+#define VGZ_EXTENSIONS 1
     uLong   start_bit;	/* Bit pos of first deflate block */
     uLong   stop_bit;	/* Bit pos after last deflate block */
     uLong   last_bit;	/* Bit pos of 'last' bit */


More information about the varnish-commit mailing list