[master] 647e1f2a9 vtc_gzip: Add the payload length in error messages

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Nov 22 10:20:06 UTC 2022


commit 647e1f2a918d1ffeec90a6f7fb57fecd50bfc2b1
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Nov 22 11:17:48 2022 +0100

    vtc_gzip: Add the payload length in error messages
    
    As a convenience, the error message includes the actual total length
    of data being g[un]zipped, in addition to the total_in amount of data
    processed so far.

diff --git a/bin/varnishtest/vtc_gzip.c b/bin/varnishtest/vtc_gzip.c
index c06e0a66e..02700bf69 100644
--- a/bin/varnishtest/vtc_gzip.c
+++ b/bin/varnishtest/vtc_gzip.c
@@ -89,8 +89,9 @@ vtc_gzip_vsb(struct vtclog *vl, int fatal, int gzip_level, const struct vsb *vin
 	} while (i == Z_OK || i == Z_BUF_ERROR);
 	if (i != Z_STREAM_END)
 		vtc_log(vl, fatal,
-		    "Gzip error = %d (%s) in:%jd out:%jd",
-		    i, vz.msg, (intmax_t)vz.total_in, (intmax_t)vz.total_out);
+		    "Gzip error = %d (%s) in:%jd out:%jd len:%zd",
+		    i, vz.msg, (intmax_t)vz.total_in, (intmax_t)vz.total_out,
+		    VSB_len(vin));
 	AZ(VSB_finish(vout));
 #ifdef VGZ_EXTENSIONS
 	*residual = vz.stop_bit & 7;
@@ -157,8 +158,9 @@ vtc_gunzip_vsb(struct vtclog *vl, int fatal, const struct vsb *vin)
 	} while (i == Z_OK || i == Z_BUF_ERROR);
 	if (i != Z_STREAM_END)
 		vtc_log(vl, fatal,
-		    "Gunzip error = %d (%s) in:%jd out:%jd",
-		    i, vz.msg, (intmax_t)vz.total_in, (intmax_t)vz.total_out);
+		    "Gunzip error = %d (%s) in:%jd out:%jd len:%zd",
+		    i, vz.msg, (intmax_t)vz.total_in, (intmax_t)vz.total_out,
+		    VSB_len(vin));
 	AZ(VSB_finish(vout));
 #ifdef VGZ_EXTENSIONS
 	vtc_report_gz_bits(vl, &vz);


More information about the varnish-commit mailing list