]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: replace acl_parse_ver with acl_parse_str
authorWilly Tarreau <w@1wt.eu>
Sun, 31 Mar 2013 16:49:18 +0000 (18:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 3 Apr 2013 00:13:01 +0000 (02:13 +0200)
The HTTP version parser used in ACLs has long been a string and
still had its own parser. This makes no sense, switch it to use
the standard string parser.

src/proto_http.c

index c38a58a2b3f740d1e375ff329ee3fa4a569c7727..50a45acfbac1c133c2065df59378c4044ae8344b 100644 (file)
@@ -8522,20 +8522,6 @@ static int acl_match_meth(struct sample *smp, struct acl_pattern *pattern)
        return ACL_PAT_PASS;
 }
 
-/* 2. Check on Request/Status Version
- * We simply compare strings here.
- */
-static int acl_parse_ver(const char **text, struct acl_pattern *pattern, int *opaque, char **err)
-{
-       pattern->ptr.str = strdup(*text);
-       if (!pattern->ptr.str) {
-               memprintf(err, "out of memory while loading pattern");
-               return 0;
-       }
-       pattern->len = strlen(*text);
-       return 1;
-}
-
 static int
 smp_fetch_rqver(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp)
@@ -9571,8 +9557,8 @@ static struct acl_kw_list acl_kws = {{ },{
        { "path_sub",        "path",          acl_parse_str,     acl_match_sub     },
 
        { "req_proto_http",  "req.proto_http",acl_parse_nothing, acl_match_nothing },
-       { "req_ver",         "req.ver",       acl_parse_ver,     acl_match_str     },
-       { "resp_ver",        "res.ver",       acl_parse_ver,     acl_match_str     },
+       { "req_ver",         "req.ver",       acl_parse_str,     acl_match_str     },
+       { "resp_ver",        "res.ver",       acl_parse_str,     acl_match_str     },
 
        { "scook",           "res.cook",      acl_parse_str,     acl_match_str     },
        { "scook_beg",       "res.cook",      acl_parse_str,     acl_match_beg     },