]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] halog: support backslash-escaped quotes
authorWilly Tarreau <w@1wt.eu>
Tue, 6 Sep 2011 06:11:27 +0000 (08:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 6 Sep 2011 06:11:27 +0000 (08:11 +0200)
Some syslog servers escape quotes, which make the resulting logs unusable
for URL processing since the parser looks for the first field beginning
with a quote. It now supports also fields starting with backslash and
quote in order to address this. No performance impact was measured.

contrib/halog/halog.c

index 39e4320c847d29b347e65baa45b6b6a8bd84bd46..32ca6709937f053c43599fa1297410988abaa6ff 100644 (file)
@@ -1127,8 +1127,12 @@ void filter_count_url(const char *accept_field, const char *time_field, struct t
         * if there's nothing else.
         */
        e = field_start(e, METH_FIELD - TIME_FIELD + 1); // avg 100 ns per line
-       while (*e != '"' && *e)
+       while (*e != '"' && *e) {
+               /* Note: some syslog servers escape quotes ! */
+               if (*e == '\\' && e[1] == '"')
+                       break;
                e = field_start(e, 2);
+       }
 
        if (unlikely(!*e)) {
                truncated_line(linenum, line);