]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: Add new "early-hint" http-request action.
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 6 Nov 2018 09:55:34 +0000 (10:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Nov 2018 20:08:55 +0000 (21:08 +0100)
This patch adds the new "early-hint" action to "http-request" rules parser.
This action should be parsed the same way as "(add|set)-header" actions.

include/types/action.h
src/http_rules.c

index 04a9f18b0cdf6b2f15d91e9c2c4f136768c61bdf..b24ce21e6256af7721e2225f845d450c7aa0e2f9 100644 (file)
@@ -77,6 +77,7 @@ enum act_name {
        ACT_HTTP_DEL_ACL,
        ACT_HTTP_DEL_MAP,
        ACT_HTTP_SET_MAP,
+       ACT_HTTP_EARLY_HINT,
 
        /* http request actions. */
        ACT_HTTP_REQ_TARPIT,
index ce6724049ff72410a805308266af89c7adb352f2..87117bf94334c156d4a580ad225e721578b9285d 100644 (file)
@@ -208,8 +208,10 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
                else if ((rule->arg.loglevel = get_log_level(args[cur_arg]) + 1) == 0)
                        goto bad_log_level;
                cur_arg++;
-       } else if (strcmp(args[0], "add-header") == 0 || strcmp(args[0], "set-header") == 0) {
-               rule->action = *args[0] == 'a' ? ACT_HTTP_ADD_HDR : ACT_HTTP_SET_HDR;
+       } else if (strcmp(args[0], "add-header") == 0 || strcmp(args[0], "set-header") == 0 ||
+                  strcmp(args[0], "early-hint") == 0) {
+               rule->action = *args[0] == 'a' ? ACT_HTTP_ADD_HDR :
+                              *args[0] == 's' ? ACT_HTTP_SET_HDR : ACT_HTTP_EARLY_HINT;
                cur_arg = 1;
 
                if (!*args[cur_arg] || !*args[cur_arg+1] ||