[3.0] cad88f4 Support for \t\n in varnishncsa format strings
Tollef Fog Heen
tfheen at varnish-cache.org
Mon Apr 16 10:20:34 CEST 2012
commit cad88f4cef11223f8ff39a9907f359487adbfcd6
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date: Mon Oct 31 14:35:28 2011 +0100
Support for \t\n in varnishncsa format strings
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index e0d6d32..ae3e4cb 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -626,6 +626,14 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
for (p = format; *p != '\0'; p++) {
+ /* allow the most essential escape sequences in format. */
+ if (*p == '\\') {
+ p++;
+ if (*p == 't') VSB_putc(os, '\t');
+ if (*p == 'n') VSB_putc(os, '\n');
+ continue;
+ }
+
if (*p != '%') {
VSB_putc(os, *p);
continue;
diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst
index ddb6538..8499d29 100644
--- a/doc/sphinx/reference/varnishncsa.rst
+++ b/doc/sphinx/reference/varnishncsa.rst
@@ -54,6 +54,8 @@ The following options are available:
%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"
+ Escape sequences \\n and \\t are supported.
+
Supported formatters are:
%b
More information about the varnish-commit
mailing list