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.
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 0e51412..fc86475 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -534,11 +534,13 @@
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 {
diff --git a/include/types/proto_tcp.h b/include/types/proto_tcp.h
index a6af2d3..d34ff03 100644
--- a/include/types/proto_tcp.h
+++ b/include/types/proto_tcp.h
@@ -65,6 +65,7 @@
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 {
diff --git a/src/proto_http.c b/src/proto_http.c
index def5670..5b06233 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -12809,6 +12809,9 @@
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 @@
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];
}
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 4a4a806..036191b 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -145,6 +145,9 @@
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 @@
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 @@
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];
}