r2892 - trunk/varnish-cache/bin/varnishtest

phk at projects.linpro.no phk at projects.linpro.no
Mon Jul 7 23:22:06 CEST 2008


Author: phk
Date: 2008-07-07 23:22:06 +0200 (Mon, 07 Jul 2008)
New Revision: 2892

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
Log:
Fix an encoding bug that affects VCLs shorter than 1 char.



Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2008-07-07 21:09:05 UTC (rev 2891)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2008-07-07 21:22:06 UTC (rev 2892)
@@ -322,22 +322,7 @@
 
 	v->vcl_nbr++;
 	vsb_printf(vsb, "vcl.inline vcl%d \"", v->vcl_nbr);
-	for (vcl++; vcl[1] != '\0'; vcl++) {
-		switch (*vcl) {
-		case '\\':
-		case '"':
-			vsb_printf(vsb, "\\%c", *vcl); break;
-		case '\n':
-			vsb_printf(vsb, "\\n"); break;
-		case '\t':
-			vsb_printf(vsb, "\\t"); break;
-		default:
-			if (isgraph(*vcl) || *vcl == ' ')
-				vsb_putc(vsb, *vcl);
-			else
-				vsb_printf(vsb, "\\x%02x", *vcl);
-		}
-	}
+	varnish_cli_encode(vsb, vcl);
 	vsb_printf(vsb, "\"", *vcl);
 	vsb_finish(vsb);
 	AZ(vsb_overflowed(vsb));




More information about the varnish-commit mailing list