mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 22:31:06 +01:00
MINOR: tcp/http/conf: extends the keyword registration options
This patch permits to register a new keyword with the keyword "tcp-request content" 'tcp-request connection", tcp-response content", http-request" and "http-response" which is identified only by matching the start of the keyword. for example, we register the keyword "set-var" with the option "match_pfx" and the configuration keyword "set-var(var_name)" matchs this entry.
This commit is contained in:
parent
fbdb77582d
commit
0e11863a6f
@ -534,11 +534,13 @@ struct http_method_name {
|
||||
struct http_req_action_kw {
|
||||
const char *kw;
|
||||
int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct http_req_rule *rule, char **err);
|
||||
int match_pfx;
|
||||
};
|
||||
|
||||
struct http_res_action_kw {
|
||||
const char *kw;
|
||||
int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct http_res_rule *rule, char **err);
|
||||
int match_pfx;
|
||||
};
|
||||
|
||||
struct http_req_action_kw_list {
|
||||
|
||||
@ -65,6 +65,7 @@ struct tcp_action_kw {
|
||||
const char *kw;
|
||||
int (*parse)(const char **args, int *cur_arg, struct proxy *px,
|
||||
struct tcp_rule *rule, char **err);
|
||||
int match_pfx;
|
||||
};
|
||||
|
||||
struct tcp_action_kw_list {
|
||||
|
||||
@ -12809,6 +12809,9 @@ struct http_req_action_kw *action_http_req_custom(const char *kw)
|
||||
|
||||
list_for_each_entry(kw_list, &http_req_keywords.list, list) {
|
||||
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
||||
if (kw_list->kw[i].match_pfx &&
|
||||
strncmp(kw, kw_list->kw[i].kw, strlen(kw_list->kw[i].kw)) == 0)
|
||||
return &kw_list->kw[i];
|
||||
if (!strcmp(kw, kw_list->kw[i].kw))
|
||||
return &kw_list->kw[i];
|
||||
}
|
||||
@ -12828,6 +12831,9 @@ struct http_res_action_kw *action_http_res_custom(const char *kw)
|
||||
|
||||
list_for_each_entry(kw_list, &http_res_keywords.list, list) {
|
||||
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
||||
if (kw_list->kw[i].match_pfx &&
|
||||
strncmp(kw, kw_list->kw[i].kw, strlen(kw_list->kw[i].kw)) == 0)
|
||||
return &kw_list->kw[i];
|
||||
if (!strcmp(kw, kw_list->kw[i].kw))
|
||||
return &kw_list->kw[i];
|
||||
}
|
||||
|
||||
@ -145,6 +145,9 @@ static struct tcp_action_kw *tcp_req_conn_action(const char *kw)
|
||||
|
||||
list_for_each_entry(kw_list, &tcp_req_conn_keywords, list) {
|
||||
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
||||
if (kw_list->kw[i].match_pfx &&
|
||||
strncmp(kw, kw_list->kw[i].kw, strlen(kw_list->kw[i].kw)) == 0)
|
||||
return &kw_list->kw[i];
|
||||
if (!strcmp(kw, kw_list->kw[i].kw))
|
||||
return &kw_list->kw[i];
|
||||
}
|
||||
@ -162,6 +165,9 @@ static struct tcp_action_kw *tcp_req_cont_action(const char *kw)
|
||||
|
||||
list_for_each_entry(kw_list, &tcp_req_cont_keywords, list) {
|
||||
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
||||
if (kw_list->kw[i].match_pfx &&
|
||||
strncmp(kw, kw_list->kw[i].kw, strlen(kw_list->kw[i].kw)) == 0)
|
||||
return &kw_list->kw[i];
|
||||
if (!strcmp(kw, kw_list->kw[i].kw))
|
||||
return &kw_list->kw[i];
|
||||
}
|
||||
@ -179,6 +185,9 @@ static struct tcp_action_kw *tcp_res_cont_action(const char *kw)
|
||||
|
||||
list_for_each_entry(kw_list, &tcp_res_cont_keywords, list) {
|
||||
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
||||
if (kw_list->kw[i].match_pfx &&
|
||||
strncmp(kw, kw_list->kw[i].kw, strlen(kw_list->kw[i].kw)) == 0)
|
||||
return &kw_list->kw[i];
|
||||
if (!strcmp(kw, kw_list->kw[i].kw))
|
||||
return &kw_list->kw[i];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user