[master] 862c6a1 Don't output trailing '\0' of SLT_Debug records

Martin Blix Grydeland martin at varnish-software.com
Wed Feb 5 15:42:34 CET 2014


commit 862c6a174ac335a5aba048d9e4af733ab9c64f2f
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Feb 5 15:40:22 2014 +0100

    Don't output trailing '\0' of SLT_Debug records
    
    SLT_Debug is special as it is both used as a binary log record and as
    a text record. Add a special case for it and don't escape-output the
    trailing zero.

diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 363085a..6e0f20a 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -255,6 +255,8 @@ VSL_Print(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
 	if (VSL_tagflags[tag] & SLT_F_BINARY) {
 		VSL_PRINT(fo, "%10u %-14s %c \"", vxid, VSL_tags[tag], type);
 		while (len-- > 0) {
+			if (len == 0 && tag == SLT_Debug && *data == '\0')
+				break;
 			if (*data >= ' ' && *data <= '~')
 				VSL_PRINT(fo, "%c", *data);
 			else
@@ -288,6 +290,8 @@ VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
 	if (VSL_tagflags[tag] & SLT_F_BINARY) {
 		VSL_PRINT(fo, "%-14s \"", VSL_tags[tag]);
 		while (len-- > 0) {
+			if (len == 0 && tag == SLT_Debug && *data == '\0')
+				break;
 			if (*data >= ' ' && *data <= '~')
 				VSL_PRINT(fo, "%c", *data);
 			else



More information about the varnish-commit mailing list