From: phk Date: Mon, 7 Jul 2008 21:22:06 +0000 (+0000) Subject: Fix an encoding bug that affects VCLs shorter than 1 char. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7e5f3795518ab652dc8e3205cfee6933ddb0a11;p=varnish Fix an encoding bug that affects VCLs shorter than 1 char. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2892 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/vtc_varnish.c b/varnish-cache/bin/varnishtest/vtc_varnish.c index f9edb958..4b8ca9a8 100644 --- a/varnish-cache/bin/varnishtest/vtc_varnish.c +++ b/varnish-cache/bin/varnishtest/vtc_varnish.c @@ -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));