]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http_act: Make set/add-headers-bin compatible with ACL conditions
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Apr 2026 09:17:47 +0000 (11:17 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Apr 2026 14:34:37 +0000 (16:34 +0200)
An error is erroneously triggered if a if/unless statement is found after
set-headers-bin and add-headers-bin actions. To make it works, during
parsing of these actions, we should leave when an unknown argument is found
to let the rule parser the opportunity to parse an if/unless statement.

No backport needed.

src/http_act.c

index c2aab4eccf51360d3413462029a4033e9665844a..b8d3ce3fb9a91d872655fb77c73a9268254ca863 100644 (file)
@@ -1712,22 +1712,14 @@ static enum act_parse_ret parse_http_set_headers_bin(const char **args, int *ori
                return ACT_RET_PRS_ERR;
        }
 
-       cur_arg++;
-
        /* Check if an argument is available */
-       if (*args[cur_arg]) {
-               if (strcmp(args[cur_arg], "prefix") == 0 ) {
-                       if(!*args[cur_arg+1]) {
-                               memprintf(err, "expects 1 argument: <headers>; or 3 arguments: <headers> prefix <pfx>");
-                               return ACT_RET_PRS_ERR;
-                       } else {
-                               cur_arg++;
-                               rule->arg.http.str = ist(strdup(args[cur_arg]));
-                       }
-               } else {
+       if (*args[cur_arg+1] && strcmp(args[cur_arg+1], "prefix") == 0 ) {
+               if(!*args[cur_arg+2]) {
                        memprintf(err, "expects 1 argument: <headers>; or 3 arguments: <headers> prefix <pfx>");
                        return ACT_RET_PRS_ERR;
                }
+               cur_arg += 2;
+               rule->arg.http.str = ist(strdup(args[cur_arg]));
        }
 
        *orig_arg = cur_arg + 1;