]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: action: add reference to the original keywork matched for the called parser.
authorThierry FOURNIER <tfournier@arpalert.org>
Tue, 22 Sep 2015 17:14:35 +0000 (19:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Sep 2015 19:44:23 +0000 (21:44 +0200)
This is usefull because the keyword can contains some condifiguration
data set while the keyword registration.

include/types/action.h
src/proto_http.c
src/proto_tcp.c

index d74e5ba30b3c50e64f84aaa27226c76c21ead118..b7e1063cc555ae5e5cd62eacfa4ae964e4db9f36 100644 (file)
@@ -93,6 +93,7 @@ struct act_rule {
        short deny_status;                     /* HTTP status to return to user when denying */
        enum act_return (*action_ptr)(struct act_rule *rule, struct proxy *px,
                                      struct session *sess, struct stream *s); /* ptr to custom action */
+       struct action_kw *kw;
        union {
                struct {
                        char *realm;
index 57cc35487b89c240a2f85988fd10037e8cbf82a0..9acf0a2eb76eb14591fa47a14ab5338a21ca5336 100644 (file)
@@ -9442,6 +9442,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
                cur_arg = 1;
                /* try in the module list */
                rule->from = ACT_F_HTTP_REQ;
+               rule->kw = custom;
                if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) == ACT_RET_PRS_ERR) {
                        Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n",
                              file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
@@ -9798,6 +9799,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
                cur_arg = 1;
                /* try in the module list */
                rule->from = ACT_F_HTTP_RES;
+               rule->kw = custom;
                if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) == ACT_RET_PRS_ERR) {
                        Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n",
                              file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
index e671e41404a844bd7577da0fbb591ee833e5829c..2ea7161a4b1f48f3a176f1e00a9c2e896972c2de 100644 (file)
@@ -1435,6 +1435,7 @@ static int tcp_parse_response_rule(char **args, int arg, int section_type,
                if (kw) {
                        arg++;
                        rule->from = ACT_F_TCP_RES_CNT;
+                       rule->kw = kw;
                        if (kw->parse((const char **)args, &arg, curpx, rule, err) == ACT_RET_PRS_ERR)
                                return -1;
                } else {
@@ -1636,9 +1637,11 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
                struct action_kw *kw;
                if (where & SMP_VAL_FE_CON_ACC) {
                        kw = tcp_req_conn_action(args[arg]);
+                       rule->kw = kw;
                        rule->from = ACT_F_TCP_REQ_CON;
                } else {
                        kw = tcp_req_cont_action(args[arg]);
+                       rule->kw = kw;
                        rule->from = ACT_F_TCP_REQ_CNT;
                }
                if (kw) {