]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] acl: permit to return any header when no name specified
authorWilly Tarreau <w@1wt.eu>
Sun, 10 Jun 2007 19:42:55 +0000 (21:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 Jun 2007 19:42:55 +0000 (21:42 +0200)
Having the ability to match on hdr_xxx in addition to hdr_xxx(yyy)
makes it possible to match any value or to count the headers easily.

src/proto_http.c

index 84aa91ae1292eb3c0fb9d8d18d66f64af3fed225..8a13a71843504a5173f5870a06a632e9e9e9478c 100644 (file)
@@ -495,6 +495,14 @@ int http_find_header2(const char *name, int len,
        while (cur_idx) {
                eol = sol + idx->v[cur_idx].len;
 
+               if (len == 0) {
+                       /* No argument was passed, we want any header.
+                        * To achieve this, we simply build a fake request. */
+                       while (sol + len < eol && sol[len] != ':')
+                               len++;
+                       name = sol;
+               }
+
                if ((len < eol - sol) &&
                    (sol[len] == ':') &&
                    (strncasecmp(sol, name, len) == 0)) {