]> err.no Git - varnish/commitdiff
escape control characters in SLT_Debug as %XX
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 6 Sep 2006 06:39:52 +0000 (06:39 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 6 Sep 2006 06:39:52 +0000 (06:39 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@916 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvarnishapi/shmlog.c

index 41b440000f82d1ed7e4095d5f79182d7b81342aa..d87656e3f5b13dd8c608d00a6541bfcc7c801257 100644 (file)
@@ -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],