MEDIUM: pattern: integrate pattern_data into sample and use sample everywhere
Now there is no more reference to union pattern_data. All pattern fetch and
conversion functions now make use of the common sample type. Note: none of
them adjust the type right now so it's important to do it next otherwise
we would risk sharing such functions with ACLs and seeing them fail.
diff --git a/src/proto_http.c b/src/proto_http.c
index f3db682..4d504b0 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -8348,12 +8348,12 @@
/* Returns the last occurrence of specified header. */
static int
pattern_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
- const struct arg *arg_p, union pattern_data *data)
+ const struct arg *arg_p, struct sample *smp)
{
struct http_txn *txn = l7;
return http_get_hdr(&txn->req, arg_p->data.str.str, arg_p->data.str.len, &txn->hdr_idx,
- -1, NULL, &data->str.str, &data->str.len);
+ -1, NULL, &smp->data.str.str, &smp->data.str.len);
}
/*
@@ -8443,7 +8443,7 @@
static int
pattern_fetch_url_param(struct proxy *px, struct session *l4, void *l7, int dir,
- const struct arg *arg_p, union pattern_data *data)
+ const struct arg *arg_p, struct sample *smp)
{
struct http_txn *txn = l7;
struct http_msg *msg = &txn->req;
@@ -8455,8 +8455,8 @@
&url_param_value, &url_param_value_l))
return 0;
- data->str.str = url_param_value;
- data->str.len = url_param_value_l;
+ smp->data.str.str = url_param_value;
+ smp->data.str.len = url_param_value_l;
return 1;
}
@@ -8496,7 +8496,7 @@
static int
pattern_fetch_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
- const struct arg *arg_p, union pattern_data *data)
+ const struct arg *arg_p, struct sample *smp)
{
struct http_txn *txn = l7;
struct http_msg *msg = &txn->req;
@@ -8508,8 +8508,8 @@
arg_p->data.str.str, arg_p->data.str.len, 1,
&cookie_value, &cookie_value_l);
if (found) {
- data->str.str = cookie_value;
- data->str.len = cookie_value_l;
+ smp->data.str.str = cookie_value;
+ smp->data.str.len = cookie_value_l;
}
return found;
@@ -8518,7 +8518,7 @@
static int
pattern_fetch_set_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
- const struct arg *arg_p, union pattern_data *data)
+ const struct arg *arg_p, struct sample *smp)
{
struct http_txn *txn = l7;
struct http_msg *msg = &txn->rsp;
@@ -8530,8 +8530,8 @@
arg_p->data.str.str, arg_p->data.str.len, 1,
&cookie_value, &cookie_value_l);
if (found) {
- data->str.str = cookie_value;
- data->str.len = cookie_value_l;
+ smp->data.str.str = cookie_value;
+ smp->data.str.len = cookie_value_l;
}
return found;