From: phk Date: Wed, 6 Sep 2006 06:39:52 +0000 (+0000) Subject: escape control characters in SLT_Debug as %XX X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62c887a3923f92d97dcf33dccf24c636caea3d57;p=varnish escape control characters in SLT_Debug as %XX git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@916 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvarnishapi/shmlog.c b/varnish-cache/lib/libvarnishapi/shmlog.c index 41b44000..d87656e3 100644 --- a/varnish-cache/lib/libvarnishapi/shmlog.c +++ b/varnish-cache/lib/libvarnishapi/shmlog.c @@ -291,6 +291,17 @@ VSL_H_Print(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, assert(fo != NULL); if (tag == SLT_Debug) { + fprintf(fo, "%5d %-12s %c \"", fd, VSL_tags[tag], + ((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' ')); + while (len-- > 0) { + if (*ptr >= ' ' && *ptr <= '~') + fprintf(fo, "%c", *ptr); + else + fprintf(fo, "%%%02x", *ptr); + ptr++; + } + fprintf(fo, "\"\n"); + return (0); } fprintf(fo, "%5d %-12s %c %.*s\n", fd, VSL_tags[tag],