[master] e9e02a4 Support for \t\n in varnishncsa format strings
Tollef Fog Heen
tfheen at varnish-cache.org
Mon Oct 31 14:37:32 CET 2011
commit e9e02a49c2a5606264b3ee9cd8e1c795639f4d61
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 f699d9b..8d969eb 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -629,6 +629,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