]> err.no Git - varnish/commitdiff
Fix an encoding bug that affects VCLs shorter than 1 char.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Jul 2008 21:22:06 +0000 (21:22 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Jul 2008 21:22:06 +0000 (21:22 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2892 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc_varnish.c

index f9edb958500348ffae1218a6b109526f87ea5766..4b8ca9a80d618c7e79300bfffb6f0e3dc1430978 100644 (file)
@@ -322,22 +322,7 @@ varnish_vcl(struct varnish *v, const char *vcl, enum cli_status_e expect)
 
        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));