mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 15:34:35 +00:00
MINOR: actions: add "from" information
This struct member is used to specify who is the rule caller. It permits to use one function for differents callers.
This commit is contained in:
parent
d0d65aeab6
commit
5563e4b469
@ -24,10 +24,19 @@
|
||||
|
||||
#include <types/stick_table.h>
|
||||
|
||||
enum act_from {
|
||||
ACT_F_TCP_REQ_CON, /* tcp-request connection */
|
||||
ACT_F_TCP_REQ_CNT, /* tcp-request content */
|
||||
ACT_F_TCP_RES_CNT, /* tcp-response content */
|
||||
ACT_F_HTTP_REQ, /* http-request */
|
||||
ACT_F_HTTP_RES, /* http-response */
|
||||
};
|
||||
|
||||
struct act_rule {
|
||||
struct list list;
|
||||
struct acl_cond *cond; /* acl condition to meet */
|
||||
unsigned int action; /* HTTP_REQ_* */
|
||||
enum act_from from; /* ACT_F_* */
|
||||
short deny_status; /* HTTP status to return to user when denying */
|
||||
int (*action_ptr)(struct act_rule *rule, struct proxy *px,
|
||||
struct session *sess, struct stream *s); /* ptr to custom action */
|
||||
|
@ -9351,6 +9351,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
char *errmsg = NULL;
|
||||
cur_arg = 1;
|
||||
/* try in the module list */
|
||||
rule->from = ACT_F_HTTP_REQ;
|
||||
if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) < 0) {
|
||||
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);
|
||||
@ -9706,6 +9707,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
char *errmsg = NULL;
|
||||
cur_arg = 1;
|
||||
/* try in the module list */
|
||||
rule->from = ACT_F_HTTP_RES;
|
||||
if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) < 0) {
|
||||
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);
|
||||
|
@ -1484,6 +1484,7 @@ static int tcp_parse_response_rule(char **args, int arg, int section_type,
|
||||
kw = tcp_res_cont_action(args[arg]);
|
||||
if (kw) {
|
||||
arg++;
|
||||
rule->from = ACT_F_TCP_RES_CNT;
|
||||
if (!kw->parse((const char **)args, &arg, curpx, rule, err))
|
||||
return -1;
|
||||
} else {
|
||||
@ -1683,10 +1684,13 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
|
||||
}
|
||||
else {
|
||||
struct tcp_action_kw *kw;
|
||||
if (where & SMP_VAL_FE_CON_ACC)
|
||||
if (where & SMP_VAL_FE_CON_ACC) {
|
||||
kw = tcp_req_conn_action(args[arg]);
|
||||
else
|
||||
rule->from = ACT_F_TCP_REQ_CON;
|
||||
} else {
|
||||
kw = tcp_req_cont_action(args[arg]);
|
||||
rule->from = ACT_F_TCP_REQ_CNT;
|
||||
}
|
||||
if (kw) {
|
||||
arg++;
|
||||
if (!kw->parse((const char **)args, &arg, curpx, rule, err))
|
||||
|
Loading…
Reference in New Issue
Block a user