From c7e5f3795518ab652dc8e3205cfee6933ddb0a11 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 7 Jul 2008 21:22:06 +0000 Subject: [PATCH] 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 --- varnish-cache/bin/varnishtest/vtc_varnish.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) 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)); -- 2.39.5