]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http: add-header/set-header did not accept the ACL condition
authorWilly Tarreau <w@1wt.eu>
Wed, 3 Apr 2013 12:13:58 +0000 (14:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 3 Apr 2013 12:13:58 +0000 (14:13 +0200)
Sander Klein reported this bug. The test for the extra argument on these
rules prevent any condition from being added. The bug was introduced with
the feature itself in 1.5-dev16.

src/proto_http.c

index ff71659aa9b043d1529948b13663d2a38523f29d..afb0db4a7024bbe754a6316f46889e36c08183d1 100644 (file)
@@ -8130,7 +8130,8 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i
                rule->action = *args[0] == 'a' ? HTTP_REQ_ACT_ADD_HDR : HTTP_REQ_ACT_SET_HDR;
                cur_arg = 1;
 
-               if (!*args[cur_arg] || !*args[cur_arg+1] || *args[cur_arg+2]) {
+               if (!*args[cur_arg] || !*args[cur_arg+1] ||
+                   (*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
                        Alert("parsing [%s:%d]: 'http-request %s' expects exactly 2 arguments.\n",
                              file, linenum, args[0]);
                        goto out_err;