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.
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 {
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 {
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];
}
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];
}
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];
}
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];
}
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];
}