[master] 3f8f72058 Dump gzip data in hex
Poul-Henning Kamp
phk at FreeBSD.org
Tue May 16 10:34:11 UTC 2023
commit 3f8f720581d6a2288524f721cd8ccba4e07e0a4b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue May 16 10:33:09 2023 +0000
Dump gzip data in hex
diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index dae3ff0ec..89bbfa5ed 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -224,6 +224,7 @@ void
vtc_dump(struct vtclog *vl, int lvl, const char *pfx, const char *str, int len)
{
char buf[64];
+ int quote = VSB_QUOTE_UNSAFE | VSB_QUOTE_ESCHEX;
AN(pfx);
GET_VL(vl);
@@ -234,9 +235,12 @@ vtc_dump(struct vtclog *vl, int lvl, const char *pfx, const char *str, int len)
lead[lvl < 0 ? 1: lvl], vl->id, pfx);
if (len < 0)
len = strlen(str);
+ else if (str[0] == 0x1f && str[1] == 0x8b)
+ quote = VSB_QUOTE_HEX; // Dump gzip data in HEX
VSB_quote_pfx(vl->vsb, buf, str,
- len > MAX_DUMP ? MAX_DUMP : len,
- VSB_QUOTE_UNSAFE | VSB_QUOTE_ESCHEX);
+ len > MAX_DUMP ? MAX_DUMP : len, quote);
+ if (quote == VSB_QUOTE_HEX)
+ VSB_putc(vl->vsb, '\n');
if (len > MAX_DUMP)
VSB_printf(vl->vsb, "%s [...] (%d)\n",
buf, len - MAX_DUMP);
More information about the varnish-commit
mailing list