Mailing List Archive

r916 - trunk/varnish-cache/lib/libvarnishapi
Author: phk
Date: 2006-09-06 08:39:52 +0200 (Wed, 06 Sep 2006)
New Revision: 916

Modified:
trunk/varnish-cache/lib/libvarnishapi/shmlog.c
Log:
escape control characters in SLT_Debug as %XX



Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-09-05 22:11:05 UTC (rev 915)
+++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2006-09-06 06:39:52 UTC (rev 916)
@@ -291,6 +291,17 @@

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],