mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
MEDIUM: sample: change the prototype of sample-fetches functions
This patch removes the "opt" entry from the prototype of the sample-fetches fucntions. This permits to remove some weight in the prototype call.
This commit is contained in:
parent
1d33b882d2
commit
0786d05a04
@ -126,10 +126,8 @@ void free_http_res_rules(struct list *r);
|
|||||||
struct chunk *http_error_message(struct stream *s, int msgnum);
|
struct chunk *http_error_message(struct stream *s, int msgnum);
|
||||||
struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
|
struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
|
||||||
const char **args, char **errmsg, int use_fmt);
|
const char **args, char **errmsg, int use_fmt);
|
||||||
int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *smp,
|
int smp_fetch_cookie(const struct arg *args, struct sample *smp, const char *kw, void *private);
|
||||||
const char *kw, void *private);
|
int smp_fetch_base32(const struct arg *args, struct sample *smp, const char *kw, void *private);
|
||||||
int smp_fetch_base32(unsigned int opt, const struct arg *args, struct sample *smp,
|
|
||||||
const char *kw, void *private);
|
|
||||||
|
|
||||||
enum http_meth_t find_http_meth(const char *str, const int len);
|
enum http_meth_t find_http_meth(const char *str, const int len);
|
||||||
|
|
||||||
|
@ -294,8 +294,7 @@ struct sample_conv_expr {
|
|||||||
/* Descriptor for a sample fetch method */
|
/* Descriptor for a sample fetch method */
|
||||||
struct sample_fetch {
|
struct sample_fetch {
|
||||||
const char *kw; /* configuration keyword */
|
const char *kw; /* configuration keyword */
|
||||||
int (*process)(unsigned int opt, /* fetch options (SMP_OPT_*) */
|
int (*process)(const struct arg *arg_p,
|
||||||
const struct arg *arg_p,
|
|
||||||
struct sample *smp,
|
struct sample *smp,
|
||||||
const char *kw, /* fetch processing function */
|
const char *kw, /* fetch processing function */
|
||||||
void *private); /* private value. */
|
void *private); /* private value. */
|
||||||
|
@ -1486,8 +1486,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_nbsrv(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
|
|
||||||
@ -1511,8 +1510,7 @@ smp_fetch_nbsrv(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_srv_is_up(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_srv_is_up(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct server *srv = args->data.srv;
|
struct server *srv = args->data.srv;
|
||||||
|
|
||||||
@ -1531,8 +1529,7 @@ smp_fetch_srv_is_up(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_connslots(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_connslots(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct server *iterator;
|
struct server *iterator;
|
||||||
|
|
||||||
@ -1559,8 +1556,7 @@ smp_fetch_connslots(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
|
|
||||||
/* set temp integer to the id of the backend */
|
/* set temp integer to the id of the backend */
|
||||||
static int
|
static int
|
||||||
smp_fetch_be_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_be_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TXN;
|
smp->flags = SMP_F_VOL_TXN;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -1570,8 +1566,7 @@ smp_fetch_be_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* set temp integer to the id of the server */
|
/* set temp integer to the id of the server */
|
||||||
static int
|
static int
|
||||||
smp_fetch_srv_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_srv_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
if (!objt_server(smp->strm->target))
|
if (!objt_server(smp->strm->target))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1587,8 +1582,7 @@ smp_fetch_srv_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_be_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_be_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -1601,8 +1595,7 @@ smp_fetch_be_sess_rate(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_be_conn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_be_conn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -1615,8 +1608,7 @@ smp_fetch_be_conn(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_queue_size(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_queue_size(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -1633,8 +1625,7 @@ smp_fetch_queue_size(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_avg_queue_size(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_avg_queue_size(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int nbsrv;
|
int nbsrv;
|
||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
@ -1663,8 +1654,7 @@ smp_fetch_avg_queue_size(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_srv_conn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_srv_conn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -1677,8 +1667,7 @@ smp_fetch_srv_conn(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* undefined behaviour.
|
* undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_srv_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_srv_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
|
@ -838,8 +838,7 @@ static int deflate_end(struct comp_ctx **comp_ctx)
|
|||||||
|
|
||||||
/* boolean, returns true if compression is used (either gzip or deflate) in the response */
|
/* boolean, returns true if compression is used (either gzip or deflate) in the response */
|
||||||
static int
|
static int
|
||||||
smp_fetch_res_comp(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_res_comp(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_BOOL;
|
smp->type = SMP_T_BOOL;
|
||||||
smp->data.uint = (smp->strm->comp_algo != NULL);
|
smp->data.uint = (smp->strm->comp_algo != NULL);
|
||||||
@ -848,8 +847,7 @@ smp_fetch_res_comp(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* string, returns algo */
|
/* string, returns algo */
|
||||||
static int
|
static int
|
||||||
smp_fetch_res_comp_algo(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_res_comp_algo(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
if (!smp->strm->comp_algo)
|
if (!smp->strm->comp_algo)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -159,8 +159,7 @@ int frontend_accept(struct stream *s)
|
|||||||
|
|
||||||
/* set temp integer to the id of the frontend */
|
/* set temp integer to the id of the frontend */
|
||||||
static int
|
static int
|
||||||
smp_fetch_fe_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_fe_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_SESS;
|
smp->flags = SMP_F_VOL_SESS;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -173,8 +172,7 @@ smp_fetch_fe_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* an undefined behaviour.
|
* an undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_fe_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_fe_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -187,8 +185,7 @@ smp_fetch_fe_sess_rate(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
* an undefined behaviour.
|
* an undefined behaviour.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_fe_conn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_fe_conn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
|
@ -2774,7 +2774,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
|
|||||||
smp.sess = hsmp->s->sess;
|
smp.sess = hsmp->s->sess;
|
||||||
smp.strm = hsmp->s;
|
smp.strm = hsmp->s;
|
||||||
smp.opt = 0;
|
smp.opt = 0;
|
||||||
if (!f->process(0, args, &smp, f->kw, f->private)) {
|
if (!f->process(args, &smp, f->kw, f->private)) {
|
||||||
if (hsmp->stringsafe)
|
if (hsmp->stringsafe)
|
||||||
lua_pushstring(L, "");
|
lua_pushstring(L, "");
|
||||||
else
|
else
|
||||||
@ -3957,8 +3957,8 @@ static int hlua_sample_conv_wrapper(const struct arg *arg_p, struct sample *smp,
|
|||||||
* doesn't allow "yield" functions because the HAProxy engine cannot
|
* doesn't allow "yield" functions because the HAProxy engine cannot
|
||||||
* resume sample-fetches.
|
* resume sample-fetches.
|
||||||
*/
|
*/
|
||||||
static int hlua_sample_fetch_wrapper(unsigned int opt, const struct arg *arg_p,
|
static int hlua_sample_fetch_wrapper(const struct arg *arg_p, struct sample *smp,
|
||||||
struct sample *smp, const char *kw, void *private)
|
const char *kw, void *private)
|
||||||
{
|
{
|
||||||
struct hlua_function *fcn = (struct hlua_function *)private;
|
struct hlua_function *fcn = (struct hlua_function *)private;
|
||||||
struct stream *stream = smp->strm;
|
struct stream *stream = smp->strm;
|
||||||
|
@ -591,8 +591,7 @@ void bind_dump_kws(char **out)
|
|||||||
|
|
||||||
/* set temp integer to the number of connexions to the same listening socket */
|
/* set temp integer to the number of connexions to the same listening socket */
|
||||||
static int
|
static int
|
||||||
smp_fetch_dconn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_dconn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
smp->data.uint = smp->sess->listener->nbconn;
|
smp->data.uint = smp->sess->listener->nbconn;
|
||||||
@ -601,8 +600,7 @@ smp_fetch_dconn(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* set temp integer to the id of the socket (listener) */
|
/* set temp integer to the id of the socket (listener) */
|
||||||
static int
|
static int
|
||||||
smp_fetch_so_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_so_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
smp->data.uint = smp->sess->listener->luid;
|
smp->data.uint = smp->sess->listener->luid;
|
||||||
|
@ -29,10 +29,9 @@
|
|||||||
* used with content inspection.
|
* used with content inspection.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_wait_end(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_wait_end(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
if (!(opt & SMP_OPT_FINAL)) {
|
if (!(smp->opt & SMP_OPT_FINAL)) {
|
||||||
smp->flags |= SMP_F_MAY_CHANGE;
|
smp->flags |= SMP_F_MAY_CHANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -43,12 +42,11 @@ smp_fetch_wait_end(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* return the number of bytes in the request buffer */
|
/* return the number of bytes in the request buffer */
|
||||||
static int
|
static int
|
||||||
smp_fetch_len(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct channel *chn;
|
struct channel *chn;
|
||||||
|
|
||||||
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
||||||
if (!chn->buf)
|
if (!chn->buf)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -60,15 +58,14 @@ smp_fetch_len(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* returns the type of SSL hello message (mainly used to detect an SSL hello) */
|
/* returns the type of SSL hello message (mainly used to detect an SSL hello) */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_hello_type(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_hello_type(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int hs_len;
|
int hs_len;
|
||||||
int hs_type, bleft;
|
int hs_type, bleft;
|
||||||
struct channel *chn;
|
struct channel *chn;
|
||||||
const unsigned char *data;
|
const unsigned char *data;
|
||||||
|
|
||||||
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
||||||
if (!chn->buf)
|
if (!chn->buf)
|
||||||
goto not_ssl_hello;
|
goto not_ssl_hello;
|
||||||
|
|
||||||
@ -128,8 +125,7 @@ smp_fetch_ssl_hello_type(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* Note: this decoder only works with non-wrapping data.
|
* Note: this decoder only works with non-wrapping data.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_req_ssl_ver(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_req_ssl_ver(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int version, bleft, msg_len;
|
int version, bleft, msg_len;
|
||||||
const unsigned char *data;
|
const unsigned char *data;
|
||||||
@ -265,14 +261,13 @@ smp_fetch_req_ssl_ver(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* - opaque hostname[name_len bytes]
|
* - opaque hostname[name_len bytes]
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_hello_sni(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_hello_sni(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int hs_len, ext_len, bleft;
|
int hs_len, ext_len, bleft;
|
||||||
struct channel *chn;
|
struct channel *chn;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
||||||
if (!chn->buf)
|
if (!chn->buf)
|
||||||
goto not_ssl_hello;
|
goto not_ssl_hello;
|
||||||
|
|
||||||
@ -494,20 +489,18 @@ fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, i
|
|||||||
* returned sample has type SMP_T_CSTR.
|
* returned sample has type SMP_T_CSTR.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
smp_fetch_rdp_cookie(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_rdp_cookie(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
return fetch_rdp_cookie_name(smp->strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
|
return fetch_rdp_cookie_name(smp->strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns either 1 or 0 depending on whether an RDP cookie is found or not */
|
/* returns either 1 or 0 depending on whether an RDP cookie is found or not */
|
||||||
static int
|
static int
|
||||||
smp_fetch_rdp_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_rdp_cookie_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = smp_fetch_rdp_cookie(opt, args, smp, kw, private);
|
ret = smp_fetch_rdp_cookie(args, smp, kw, private);
|
||||||
|
|
||||||
if (smp->flags & SMP_F_MAY_CHANGE)
|
if (smp->flags & SMP_F_MAY_CHANGE)
|
||||||
return 0;
|
return 0;
|
||||||
@ -520,8 +513,7 @@ smp_fetch_rdp_cookie_cnt(unsigned int opt, const struct arg *args, struct sample
|
|||||||
|
|
||||||
/* extracts part of a payload with offset and length at a given position */
|
/* extracts part of a payload with offset and length at a given position */
|
||||||
static int
|
static int
|
||||||
smp_fetch_payload_lv(unsigned int opt, const struct arg *arg_p, struct sample *smp,
|
smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
unsigned int len_offset = arg_p[0].data.uint;
|
unsigned int len_offset = arg_p[0].data.uint;
|
||||||
unsigned int len_size = arg_p[1].data.uint;
|
unsigned int len_size = arg_p[1].data.uint;
|
||||||
@ -534,7 +526,7 @@ smp_fetch_payload_lv(unsigned int opt, const struct arg *arg_p, struct sample *s
|
|||||||
/* by default buf offset == len offset + len size */
|
/* by default buf offset == len offset + len size */
|
||||||
/* buf offset could be absolute or relative to len offset + len size if prefixed by + or - */
|
/* buf offset could be absolute or relative to len offset + len size if prefixed by + or - */
|
||||||
|
|
||||||
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
||||||
if (!chn->buf)
|
if (!chn->buf)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -574,14 +566,13 @@ smp_fetch_payload_lv(unsigned int opt, const struct arg *arg_p, struct sample *s
|
|||||||
|
|
||||||
/* extracts some payload at a fixed position and length */
|
/* extracts some payload at a fixed position and length */
|
||||||
static int
|
static int
|
||||||
smp_fetch_payload(unsigned int opt, const struct arg *arg_p, struct sample *smp,
|
smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
unsigned int buf_offset = arg_p[0].data.uint;
|
unsigned int buf_offset = arg_p[0].data.uint;
|
||||||
unsigned int buf_size = arg_p[1].data.uint;
|
unsigned int buf_size = arg_p[1].data.uint;
|
||||||
struct channel *chn;
|
struct channel *chn;
|
||||||
|
|
||||||
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
|
||||||
if (!chn->buf)
|
if (!chn->buf)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
165
src/proto_http.c
165
src/proto_http.c
@ -10176,10 +10176,10 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
|
|||||||
* least the type and uint value are modified.
|
* least the type and uint value are modified.
|
||||||
*/
|
*/
|
||||||
#define CHECK_HTTP_MESSAGE_FIRST() \
|
#define CHECK_HTTP_MESSAGE_FIRST() \
|
||||||
do { int r = smp_prefetch_http(smp->px, smp->strm, opt, args, smp, 1); if (r <= 0) return r; } while (0)
|
do { int r = smp_prefetch_http(smp->px, smp->strm, smp->opt, args, smp, 1); if (r <= 0) return r; } while (0)
|
||||||
|
|
||||||
#define CHECK_HTTP_MESSAGE_FIRST_PERM() \
|
#define CHECK_HTTP_MESSAGE_FIRST_PERM() \
|
||||||
do { int r = smp_prefetch_http(smp->px, smp->strm, opt, args, smp, 0); if (r <= 0) return r; } while (0)
|
do { int r = smp_prefetch_http(smp->px, smp->strm, smp->opt, args, smp, 0); if (r <= 0) return r; } while (0)
|
||||||
|
|
||||||
|
|
||||||
/* 1. Check on METHOD
|
/* 1. Check on METHOD
|
||||||
@ -10214,8 +10214,7 @@ static int pat_parse_meth(const char *text, struct pattern *pattern, int mflags,
|
|||||||
* This is intended to be used with pat_match_meth() only.
|
* This is intended to be used with pat_match_meth() only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_meth(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_meth(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int meth;
|
int meth;
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
@ -10268,8 +10267,7 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_rqver(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_rqver(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -10293,8 +10291,7 @@ smp_fetch_rqver(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_stver(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_stver(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -10323,8 +10320,7 @@ smp_fetch_stver(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* 3. Check on Status Code. We manipulate integers here. */
|
/* 3. Check on Status Code. We manipulate integers here. */
|
||||||
static int
|
static int
|
||||||
smp_fetch_stcode(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_stcode(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -10349,8 +10345,7 @@ smp_fetch_stcode(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* has been waited for using http-buffer-request.
|
* has been waited for using http-buffer-request.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_body(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_body(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
struct http_msg *msg;
|
struct http_msg *msg;
|
||||||
@ -10361,7 +10356,7 @@ smp_fetch_body(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
|
if ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
|
||||||
msg = &txn->req;
|
msg = &txn->req;
|
||||||
else
|
else
|
||||||
msg = &txn->rsp;
|
msg = &txn->rsp;
|
||||||
@ -10398,15 +10393,14 @@ smp_fetch_body(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* has been waited for using http-buffer-request.
|
* has been waited for using http-buffer-request.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_body_len(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_body_len(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
struct http_msg *msg;
|
struct http_msg *msg;
|
||||||
|
|
||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
|
if ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
|
||||||
msg = &txn->req;
|
msg = &txn->req;
|
||||||
else
|
else
|
||||||
msg = &txn->rsp;
|
msg = &txn->rsp;
|
||||||
@ -10424,15 +10418,14 @@ smp_fetch_body_len(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* for using http-buffer-request.
|
* for using http-buffer-request.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_body_size(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_body_size(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
struct http_msg *msg;
|
struct http_msg *msg;
|
||||||
|
|
||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
|
if ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ)
|
||||||
msg = &txn->req;
|
msg = &txn->req;
|
||||||
else
|
else
|
||||||
msg = &txn->rsp;
|
msg = &txn->rsp;
|
||||||
@ -10447,8 +10440,7 @@ smp_fetch_body_size(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
|
|
||||||
/* 4. Check on URL/URI. A pointer to the URI is stored. */
|
/* 4. Check on URL/URI. A pointer to the URI is stored. */
|
||||||
static int
|
static int
|
||||||
smp_fetch_url(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
|
|
||||||
@ -10463,8 +10455,7 @@ smp_fetch_url(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_url_ip(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url_ip(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
@ -10483,8 +10474,7 @@ smp_fetch_url_ip(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_url_port(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url_port(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
@ -10510,8 +10500,7 @@ smp_fetch_url_port(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* returns full lines instead (useful for User-Agent or Date for example).
|
* returns full lines instead (useful for User-Agent or Date for example).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_fhdr(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_fhdr(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
struct hdr_ctx *ctx = smp->ctx.a[0];
|
struct hdr_ctx *ctx = smp->ctx.a[0];
|
||||||
@ -10540,13 +10529,13 @@ smp_fetch_fhdr(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
msg = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
||||||
|
|
||||||
if (ctx && !(smp->flags & SMP_F_NOT_LAST))
|
if (ctx && !(smp->flags & SMP_F_NOT_LAST))
|
||||||
/* search for header from the beginning */
|
/* search for header from the beginning */
|
||||||
ctx->idx = 0;
|
ctx->idx = 0;
|
||||||
|
|
||||||
if (!occ && !(opt & SMP_OPT_ITERATE))
|
if (!occ && !(smp->opt & SMP_OPT_ITERATE))
|
||||||
/* no explicit occurrence and single fetch => last header by default */
|
/* no explicit occurrence and single fetch => last header by default */
|
||||||
occ = -1;
|
occ = -1;
|
||||||
|
|
||||||
@ -10568,8 +10557,7 @@ smp_fetch_fhdr(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* returns full lines instead (useful for User-Agent or Date for example).
|
* returns full lines instead (useful for User-Agent or Date for example).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_fhdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_fhdr_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
struct hdr_ctx ctx;
|
struct hdr_ctx ctx;
|
||||||
@ -10586,7 +10574,7 @@ smp_fetch_fhdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
msg = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
||||||
|
|
||||||
ctx.idx = 0;
|
ctx.idx = 0;
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
@ -10600,8 +10588,7 @@ smp_fetch_fhdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_hdr_names(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_hdr_names(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
struct hdr_ctx ctx;
|
struct hdr_ctx ctx;
|
||||||
@ -10615,7 +10602,7 @@ smp_fetch_hdr_names(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
msg = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
||||||
|
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
|
|
||||||
@ -10641,8 +10628,7 @@ smp_fetch_hdr_names(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
* headers are considered from the first one.
|
* headers are considered from the first one.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_hdr(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_hdr(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
struct hdr_ctx *ctx = smp->ctx.a[0];
|
struct hdr_ctx *ctx = smp->ctx.a[0];
|
||||||
@ -10671,13 +10657,13 @@ smp_fetch_hdr(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
msg = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
||||||
|
|
||||||
if (ctx && !(smp->flags & SMP_F_NOT_LAST))
|
if (ctx && !(smp->flags & SMP_F_NOT_LAST))
|
||||||
/* search for header from the beginning */
|
/* search for header from the beginning */
|
||||||
ctx->idx = 0;
|
ctx->idx = 0;
|
||||||
|
|
||||||
if (!occ && !(opt & SMP_OPT_ITERATE))
|
if (!occ && !(smp->opt & SMP_OPT_ITERATE))
|
||||||
/* no explicit occurrence and single fetch => last header by default */
|
/* no explicit occurrence and single fetch => last header by default */
|
||||||
occ = -1;
|
occ = -1;
|
||||||
|
|
||||||
@ -10698,8 +10684,7 @@ smp_fetch_hdr(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* Accepts exactly 1 argument of type string.
|
* Accepts exactly 1 argument of type string.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_hdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_hdr_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
struct hdr_ctx ctx;
|
struct hdr_ctx ctx;
|
||||||
@ -10716,7 +10701,7 @@ smp_fetch_hdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
CHECK_HTTP_MESSAGE_FIRST();
|
CHECK_HTTP_MESSAGE_FIRST();
|
||||||
|
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
msg = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
|
||||||
|
|
||||||
ctx.idx = 0;
|
ctx.idx = 0;
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
@ -10735,10 +10720,9 @@ smp_fetch_hdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* may or may not be appropriate for everything.
|
* may or may not be appropriate for everything.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_hdr_val(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_hdr_val(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int ret = smp_fetch_hdr(opt, args, smp, kw, private);
|
int ret = smp_fetch_hdr(args, smp, kw, private);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -10753,12 +10737,11 @@ smp_fetch_hdr_val(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* It returns an IPv4 or IPv6 address.
|
* It returns an IPv4 or IPv6 address.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_hdr_ip(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_hdr_ip(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while ((ret = smp_fetch_hdr(opt, args, smp, kw, private)) > 0) {
|
while ((ret = smp_fetch_hdr(args, smp, kw, private)) > 0) {
|
||||||
if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4)) {
|
if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4)) {
|
||||||
smp->type = SMP_T_IPV4;
|
smp->type = SMP_T_IPV4;
|
||||||
break;
|
break;
|
||||||
@ -10785,8 +10768,7 @@ smp_fetch_hdr_ip(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* the first '/' after the possible hostname, and ends before the possible '?'.
|
* the first '/' after the possible hostname, and ends before the possible '?'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_path(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_path(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
char *ptr, *end;
|
char *ptr, *end;
|
||||||
@ -10819,8 +10801,7 @@ smp_fetch_path(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* The returned sample is of type string.
|
* The returned sample is of type string.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_base(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_base(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
char *ptr, *end, *beg;
|
char *ptr, *end, *beg;
|
||||||
@ -10832,7 +10813,7 @@ smp_fetch_base(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
txn = smp->strm->txn;
|
txn = smp->strm->txn;
|
||||||
ctx.idx = 0;
|
ctx.idx = 0;
|
||||||
if (!http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx) || !ctx.vlen)
|
if (!http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx) || !ctx.vlen)
|
||||||
return smp_fetch_path(opt, args, smp, kw, private);
|
return smp_fetch_path(args, smp, kw, private);
|
||||||
|
|
||||||
/* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
|
/* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
@ -10867,8 +10848,7 @@ smp_fetch_base(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* high-traffic sites without having to store whole paths.
|
* high-traffic sites without having to store whole paths.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
smp_fetch_base32(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_base32(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
struct hdr_ctx ctx;
|
struct hdr_ctx ctx;
|
||||||
@ -10916,8 +10896,7 @@ smp_fetch_base32(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* 8 bytes would still work.
|
* 8 bytes would still work.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_base32_src(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct chunk *temp;
|
struct chunk *temp;
|
||||||
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
||||||
@ -10925,7 +10904,7 @@ smp_fetch_base32_src(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
if (!cli_conn)
|
if (!cli_conn)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!smp_fetch_base32(opt, args, smp, kw, private))
|
if (!smp_fetch_base32(args, smp, kw, private))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
@ -10955,8 +10934,7 @@ smp_fetch_base32_src(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
* of type string carrying the whole query string.
|
* of type string carrying the whole query string.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_query(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_query(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
char *ptr, *end;
|
char *ptr, *end;
|
||||||
@ -10981,8 +10959,7 @@ smp_fetch_query(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_proto_http(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_proto_http(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
|
/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
|
||||||
* as a layer7 ACL, which involves automatic allocation of hdr_idx.
|
* as a layer7 ACL, which involves automatic allocation of hdr_idx.
|
||||||
@ -10997,8 +10974,7 @@ smp_fetch_proto_http(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
|
|
||||||
/* return a valid test if the current request is the first one on the connection */
|
/* return a valid test if the current request is the first one on the connection */
|
||||||
static int
|
static int
|
||||||
smp_fetch_http_first_req(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_http_first_req(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_BOOL;
|
smp->type = SMP_T_BOOL;
|
||||||
smp->data.uint = !(smp->strm->txn->flags & TX_NOT_FIRST);
|
smp->data.uint = !(smp->strm->txn->flags & TX_NOT_FIRST);
|
||||||
@ -11007,8 +10983,7 @@ smp_fetch_http_first_req(unsigned int opt, const struct arg *args, struct sample
|
|||||||
|
|
||||||
/* Accepts exactly 1 argument of type userlist */
|
/* Accepts exactly 1 argument of type userlist */
|
||||||
static int
|
static int
|
||||||
smp_fetch_http_auth(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_http_auth(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!args || args->type != ARGT_USR)
|
if (!args || args->type != ARGT_USR)
|
||||||
@ -11027,8 +11002,7 @@ smp_fetch_http_auth(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
|
|
||||||
/* Accepts exactly 1 argument of type userlist */
|
/* Accepts exactly 1 argument of type userlist */
|
||||||
static int
|
static int
|
||||||
smp_fetch_http_auth_grp(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_http_auth_grp(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
if (!args || args->type != ARGT_USR)
|
if (!args || args->type != ARGT_USR)
|
||||||
return 0;
|
return 0;
|
||||||
@ -11156,8 +11130,7 @@ extract_cookie_value(char *hdr, const char *hdr_end,
|
|||||||
* the "capture" option in the configuration file
|
* the "capture" option in the configuration file
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_capture_header_req(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_capture_header_req(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct proxy *fe = strm_fe(smp->strm);
|
struct proxy *fe = strm_fe(smp->strm);
|
||||||
int idx;
|
int idx;
|
||||||
@ -11182,8 +11155,7 @@ smp_fetch_capture_header_req(unsigned int opt, const struct arg *args, struct sa
|
|||||||
* the "capture" option in the configuration file
|
* the "capture" option in the configuration file
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_capture_header_res(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_capture_header_res(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct proxy *fe = strm_fe(smp->strm);
|
struct proxy *fe = strm_fe(smp->strm);
|
||||||
int idx;
|
int idx;
|
||||||
@ -11206,8 +11178,7 @@ smp_fetch_capture_header_res(unsigned int opt, const struct arg *args, struct sa
|
|||||||
|
|
||||||
/* Extracts the METHOD in the HTTP request, the txn->uri should be filled before the call */
|
/* Extracts the METHOD in the HTTP request, the txn->uri should be filled before the call */
|
||||||
static int
|
static int
|
||||||
smp_fetch_capture_req_method(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct chunk *temp;
|
struct chunk *temp;
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
@ -11234,8 +11205,7 @@ smp_fetch_capture_req_method(unsigned int opt, const struct arg *args, struct sa
|
|||||||
|
|
||||||
/* Extracts the path in the HTTP request, the txn->uri should be filled before the call */
|
/* Extracts the path in the HTTP request, the txn->uri should be filled before the call */
|
||||||
static int
|
static int
|
||||||
smp_fetch_capture_req_uri(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_capture_req_uri(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct chunk *temp;
|
struct chunk *temp;
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
@ -11273,8 +11243,7 @@ smp_fetch_capture_req_uri(unsigned int opt, const struct arg *args, struct sampl
|
|||||||
* as a string (either "HTTP/1.0" or "HTTP/1.1").
|
* as a string (either "HTTP/1.0" or "HTTP/1.1").
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_capture_req_ver(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_capture_req_ver(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
|
|
||||||
@ -11297,8 +11266,7 @@ smp_fetch_capture_req_ver(unsigned int opt, const struct arg *args, struct sampl
|
|||||||
* as a string (either "HTTP/1.0" or "HTTP/1.1").
|
* as a string (either "HTTP/1.0" or "HTTP/1.1").
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_capture_res_ver(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_capture_res_ver(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn = smp->strm->txn;
|
struct http_txn *txn = smp->strm->txn;
|
||||||
|
|
||||||
@ -11328,8 +11296,7 @@ smp_fetch_capture_res_ver(unsigned int opt, const struct arg *args, struct sampl
|
|||||||
* The returned sample is of type CSTR. Can be used to parse cookies in other
|
* The returned sample is of type CSTR. Can be used to parse cookies in other
|
||||||
* files.
|
* files.
|
||||||
*/
|
*/
|
||||||
int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *smp,
|
int smp_fetch_cookie(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
@ -11356,7 +11323,7 @@ int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
txn = smp->strm->txn;
|
txn = smp->strm->txn;
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
|
|
||||||
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) {
|
if ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) {
|
||||||
msg = &txn->req;
|
msg = &txn->req;
|
||||||
hdr_name = "Cookie";
|
hdr_name = "Cookie";
|
||||||
hdr_name_len = 6;
|
hdr_name_len = 6;
|
||||||
@ -11366,7 +11333,7 @@ int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
hdr_name_len = 10;
|
hdr_name_len = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!occ && !(opt & SMP_OPT_ITERATE))
|
if (!occ && !(smp->opt & SMP_OPT_ITERATE))
|
||||||
/* no explicit occurrence and single fetch => last cookie by default */
|
/* no explicit occurrence and single fetch => last cookie by default */
|
||||||
occ = -1;
|
occ = -1;
|
||||||
|
|
||||||
@ -11403,7 +11370,7 @@ int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
smp->flags |= SMP_F_CONST;
|
smp->flags |= SMP_F_CONST;
|
||||||
smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
|
smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
|
||||||
args->data.str.str, args->data.str.len,
|
args->data.str.str, args->data.str.len,
|
||||||
(opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ,
|
(smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ,
|
||||||
&smp->data.str.str,
|
&smp->data.str.str,
|
||||||
&smp->data.str.len);
|
&smp->data.str.len);
|
||||||
if (smp->ctx.a[0]) {
|
if (smp->ctx.a[0]) {
|
||||||
@ -11430,8 +11397,7 @@ int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
* type UINT. Accepts exactly 1 argument of type string.
|
* type UINT. Accepts exactly 1 argument of type string.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_cookie_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
struct hdr_idx *idx;
|
struct hdr_idx *idx;
|
||||||
@ -11451,7 +11417,7 @@ smp_fetch_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
txn = smp->strm->txn;
|
txn = smp->strm->txn;
|
||||||
idx = &smp->strm->txn->hdr_idx;
|
idx = &smp->strm->txn->hdr_idx;
|
||||||
|
|
||||||
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) {
|
if ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) {
|
||||||
msg = &txn->req;
|
msg = &txn->req;
|
||||||
hdr_name = "Cookie";
|
hdr_name = "Cookie";
|
||||||
hdr_name_len = 6;
|
hdr_name_len = 6;
|
||||||
@ -11483,7 +11449,7 @@ smp_fetch_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
smp->flags |= SMP_F_CONST;
|
smp->flags |= SMP_F_CONST;
|
||||||
while ((val_beg = extract_cookie_value(val_beg, val_end,
|
while ((val_beg = extract_cookie_value(val_beg, val_end,
|
||||||
args->data.str.str, args->data.str.len,
|
args->data.str.str, args->data.str.len,
|
||||||
(opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ,
|
(smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ,
|
||||||
&smp->data.str.str,
|
&smp->data.str.str,
|
||||||
&smp->data.str.len))) {
|
&smp->data.str.len))) {
|
||||||
cnt++;
|
cnt++;
|
||||||
@ -11500,10 +11466,9 @@ smp_fetch_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
* takes a mandatory argument of type string. It relies on smp_fetch_cookie().
|
* takes a mandatory argument of type string. It relies on smp_fetch_cookie().
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_cookie_val(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_cookie_val(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int ret = smp_fetch_cookie(opt, args, smp, kw, private);
|
int ret = smp_fetch_cookie(args, smp, kw, private);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -11605,8 +11570,7 @@ find_url_param_value(char* path, size_t path_l,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_url_param(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url_param(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
char delim = '?';
|
char delim = '?';
|
||||||
struct http_msg *msg;
|
struct http_msg *msg;
|
||||||
@ -11637,10 +11601,9 @@ smp_fetch_url_param(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
* above).
|
* above).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_url_param_val(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url_param_val(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int ret = smp_fetch_url_param(opt, args, smp, kw, private);
|
int ret = smp_fetch_url_param(args, smp, kw, private);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -11661,8 +11624,7 @@ smp_fetch_url_param_val(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* as well as the path
|
* as well as the path
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_url32(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url32(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct http_txn *txn;
|
struct http_txn *txn;
|
||||||
struct hdr_ctx ctx;
|
struct hdr_ctx ctx;
|
||||||
@ -11710,13 +11672,12 @@ smp_fetch_url32(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* 8 bytes would still work.
|
* 8 bytes would still work.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_url32_src(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct chunk *temp;
|
struct chunk *temp;
|
||||||
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
||||||
|
|
||||||
if (!smp_fetch_url32(opt, args, smp, kw, private))
|
if (!smp_fetch_url32(args, smp, kw, private))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
|
@ -1963,8 +1963,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
|
|||||||
|
|
||||||
/* fetch the connection's source IPv4/IPv6 address */
|
/* fetch the connection's source IPv4/IPv6 address */
|
||||||
static int
|
static int
|
||||||
smp_fetch_src(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
||||||
|
|
||||||
@ -1990,8 +1989,7 @@ smp_fetch_src(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* set temp integer to the connection's source port */
|
/* set temp integer to the connection's source port */
|
||||||
static int
|
static int
|
||||||
smp_fetch_sport(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sport(const struct arg *args, struct sample *smp, const char *k, void *private)
|
||||||
const char *k, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
||||||
|
|
||||||
@ -2008,8 +2006,7 @@ smp_fetch_sport(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* fetch the connection's destination IPv4/IPv6 address */
|
/* fetch the connection's destination IPv4/IPv6 address */
|
||||||
static int
|
static int
|
||||||
smp_fetch_dst(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_dst(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
||||||
|
|
||||||
@ -2037,8 +2034,7 @@ smp_fetch_dst(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* set temp integer to the frontend connexion's destination port */
|
/* set temp integer to the frontend connexion's destination port */
|
||||||
static int
|
static int
|
||||||
smp_fetch_dport(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_dport(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
struct connection *cli_conn = objt_conn(smp->sess->origin);
|
||||||
|
|
||||||
|
26
src/sample.c
26
src/sample.c
@ -1037,7 +1037,7 @@ struct sample *sample_process(struct proxy *px, struct session *sess,
|
|||||||
p->sess = sess;
|
p->sess = sess;
|
||||||
p->strm = strm;
|
p->strm = strm;
|
||||||
p->opt = opt;
|
p->opt = opt;
|
||||||
if (!expr->fetch->process(opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
|
if (!expr->fetch->process(expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
list_for_each_entry(conv_expr, &expr->conv_exprs, list) {
|
list_for_each_entry(conv_expr, &expr->conv_exprs, list) {
|
||||||
@ -2131,8 +2131,7 @@ static int sample_conv_arith_even(const struct arg *arg_p,
|
|||||||
|
|
||||||
/* force TRUE to be returned at the fetch level */
|
/* force TRUE to be returned at the fetch level */
|
||||||
static int
|
static int
|
||||||
smp_fetch_true(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_true(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_BOOL;
|
smp->type = SMP_T_BOOL;
|
||||||
smp->data.uint = 1;
|
smp->data.uint = 1;
|
||||||
@ -2141,8 +2140,7 @@ smp_fetch_true(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* force FALSE to be returned at the fetch level */
|
/* force FALSE to be returned at the fetch level */
|
||||||
static int
|
static int
|
||||||
smp_fetch_false(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_false(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_BOOL;
|
smp->type = SMP_T_BOOL;
|
||||||
smp->data.uint = 0;
|
smp->data.uint = 0;
|
||||||
@ -2151,8 +2149,7 @@ smp_fetch_false(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* retrieve environment variable $1 as a string */
|
/* retrieve environment variable $1 as a string */
|
||||||
static int
|
static int
|
||||||
smp_fetch_env(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_env(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
char *env;
|
char *env;
|
||||||
|
|
||||||
@ -2174,8 +2171,7 @@ smp_fetch_env(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* of args[0] seconds.
|
* of args[0] seconds.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_date(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_date(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->data.uint = date.tv_sec;
|
smp->data.uint = date.tv_sec;
|
||||||
|
|
||||||
@ -2190,8 +2186,7 @@ smp_fetch_date(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* returns the number of processes */
|
/* returns the number of processes */
|
||||||
static int
|
static int
|
||||||
smp_fetch_nbproc(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
smp->data.uint = global.nbproc;
|
smp->data.uint = global.nbproc;
|
||||||
@ -2200,8 +2195,7 @@ smp_fetch_nbproc(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* returns the number of the current process (between 1 and nbproc */
|
/* returns the number of the current process (between 1 and nbproc */
|
||||||
static int
|
static int
|
||||||
smp_fetch_proc(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
smp->data.uint = relative_pid;
|
smp->data.uint = relative_pid;
|
||||||
@ -2212,8 +2206,7 @@ smp_fetch_proc(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
* range specified in argument.
|
* range specified in argument.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_rand(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_rand(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->data.uint = random();
|
smp->data.uint = random();
|
||||||
|
|
||||||
@ -2228,8 +2221,7 @@ smp_fetch_rand(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* returns true if the current process is stopping */
|
/* returns true if the current process is stopping */
|
||||||
static int
|
static int
|
||||||
smp_fetch_stopping(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_stopping(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->type = SMP_T_BOOL;
|
smp->type = SMP_T_BOOL;
|
||||||
smp->data.uint = stopping;
|
smp->data.uint = stopping;
|
||||||
|
@ -3084,8 +3084,7 @@ unsigned int ssl_sock_get_verify_result(struct connection *conn)
|
|||||||
|
|
||||||
/* boolean, returns true if client cert was present */
|
/* boolean, returns true if client cert was present */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_has_crt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_has_crt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
@ -3110,8 +3109,7 @@ smp_fetch_ssl_fc_has_crt(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_der(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_der(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3155,8 +3153,7 @@ out:
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_serial(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_serial(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3200,8 +3197,7 @@ out:
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_sha1(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_sha1(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3245,8 +3241,7 @@ out:
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_notafter(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_notafter(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3289,8 +3284,7 @@ out:
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_i_dn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_i_dn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3349,8 +3343,7 @@ out:
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_notbefore(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_notbefore(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3393,8 +3386,7 @@ out:
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_s_dn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_s_dn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt = NULL;
|
X509 *crt = NULL;
|
||||||
@ -3450,8 +3442,7 @@ out:
|
|||||||
|
|
||||||
/* integer, returns true if current session use a client certificate */
|
/* integer, returns true if current session use a client certificate */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_c_used(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_c_used(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
X509 *crt;
|
X509 *crt;
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
@ -3481,8 +3472,7 @@ smp_fetch_ssl_c_used(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_version(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_version(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt;
|
X509 *crt;
|
||||||
@ -3518,8 +3508,7 @@ smp_fetch_ssl_x_version(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_sig_alg(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_sig_alg(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt;
|
X509 *crt;
|
||||||
@ -3567,8 +3556,7 @@ smp_fetch_ssl_x_sig_alg(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* should be use.
|
* should be use.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_x_key_alg(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_x_key_alg(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||||
X509 *crt;
|
X509 *crt;
|
||||||
@ -3615,8 +3603,7 @@ smp_fetch_ssl_x_key_alg(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* char is 'b'.
|
* char is 'b'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
struct connection *conn = objt_conn(smp->strm->si[back_conn].end);
|
struct connection *conn = objt_conn(smp->strm->si[back_conn].end);
|
||||||
@ -3628,8 +3615,7 @@ smp_fetch_ssl_fc(unsigned int opt, const struct arg *args, struct sample *smp,
|
|||||||
|
|
||||||
/* boolean, returns true if client present a SNI */
|
/* boolean, returns true if client present a SNI */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_has_sni(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_has_sni(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
||||||
struct connection *conn = objt_conn(smp->sess->origin);
|
struct connection *conn = objt_conn(smp->sess->origin);
|
||||||
@ -3649,8 +3635,7 @@ smp_fetch_ssl_fc_has_sni(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* char is 'b'.
|
* char is 'b'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_cipher(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_cipher(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
@ -3678,8 +3663,7 @@ smp_fetch_ssl_fc_cipher(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* char is 'b'.
|
* char is 'b'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_alg_keysize(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_alg_keysize(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
@ -3703,8 +3687,7 @@ smp_fetch_ssl_fc_alg_keysize(unsigned int opt, const struct arg *args, struct sa
|
|||||||
* char is 'b'.
|
* char is 'b'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_use_keysize(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_use_keysize(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
@ -3726,8 +3709,7 @@ smp_fetch_ssl_fc_use_keysize(unsigned int opt, const struct arg *args, struct sa
|
|||||||
|
|
||||||
#ifdef OPENSSL_NPN_NEGOTIATED
|
#ifdef OPENSSL_NPN_NEGOTIATED
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_npn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_npn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
@ -3751,8 +3733,7 @@ smp_fetch_ssl_fc_npn(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
|
|
||||||
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
|
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_alpn(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_alpn(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
@ -3779,8 +3760,7 @@ smp_fetch_ssl_fc_alpn(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* char is 'b'.
|
* char is 'b'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_protocol(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_protocol(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
@ -3807,8 +3787,7 @@ smp_fetch_ssl_fc_protocol(unsigned int opt, const struct arg *args, struct sampl
|
|||||||
* char is 'b'.
|
* char is 'b'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_session_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_session_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
|
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
@ -3837,8 +3816,7 @@ smp_fetch_ssl_fc_session_id(unsigned int opt, const struct arg *args, struct sam
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_sni(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_sni(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
@ -3862,8 +3840,7 @@ smp_fetch_ssl_fc_sni(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_fc_unique_id(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_fc_unique_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
|
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
|
||||||
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
int back_conn = (kw[4] == 'b') ? 1 : 0;
|
||||||
@ -3903,8 +3880,7 @@ smp_fetch_ssl_fc_unique_id(unsigned int opt, const struct arg *args, struct samp
|
|||||||
|
|
||||||
/* integer, returns the first verify error in CA chain of client certificate chain. */
|
/* integer, returns the first verify error in CA chain of client certificate chain. */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_c_ca_err(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_c_ca_err(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
@ -3926,8 +3902,7 @@ smp_fetch_ssl_c_ca_err(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
|
|
||||||
/* integer, returns the depth of the first verify error in CA chain of client certificate chain. */
|
/* integer, returns the depth of the first verify error in CA chain of client certificate chain. */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_c_ca_err_depth(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_c_ca_err_depth(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
@ -3949,8 +3924,7 @@ smp_fetch_ssl_c_ca_err_depth(unsigned int opt, const struct arg *args, struct sa
|
|||||||
|
|
||||||
/* integer, returns the first verify error on client certificate */
|
/* integer, returns the first verify error on client certificate */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_c_err(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_c_err(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
@ -3972,8 +3946,7 @@ smp_fetch_ssl_c_err(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
|
|
||||||
/* integer, returns the verify result on client cert */
|
/* integer, returns the verify result on client cert */
|
||||||
static int
|
static int
|
||||||
smp_fetch_ssl_c_verify(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_ssl_c_verify(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn;
|
struct connection *conn;
|
||||||
|
|
||||||
|
66
src/stream.c
66
src/stream.c
@ -2585,8 +2585,7 @@ smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg
|
|||||||
* Supports being called as "sc[0-9]_tracked" only.
|
* Supports being called as "sc[0-9]_tracked" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_tracked(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_tracked(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_BOOL;
|
smp->type = SMP_T_BOOL;
|
||||||
@ -2600,8 +2599,7 @@ smp_fetch_sc_tracked(unsigned int opt, const struct arg *args, struct sample *sm
|
|||||||
* zero is returned if the key is new.
|
* zero is returned if the key is new.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_get_gpc0(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_get_gpc0(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2627,8 +2625,7 @@ smp_fetch_sc_get_gpc0(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* Value zero is returned if the key is new.
|
* Value zero is returned if the key is new.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_gpc0_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_gpc0_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2653,8 +2650,7 @@ smp_fetch_sc_gpc0_rate(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
* Supports being called as "sc[0-9]_inc_gpc0" or "src_inc_gpc0" only.
|
* Supports being called as "sc[0-9]_inc_gpc0" or "src_inc_gpc0" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_inc_gpc0(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_inc_gpc0(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2690,8 +2686,7 @@ smp_fetch_sc_inc_gpc0(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* Supports being called as "sc[0-9]_clr_gpc0" or "src_clr_gpc0" only.
|
* Supports being called as "sc[0-9]_clr_gpc0" or "src_clr_gpc0" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_clr_gpc0(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_clr_gpc0(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2716,8 +2711,7 @@ smp_fetch_sc_clr_gpc0(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* "src_conn_cnt" only.
|
* "src_conn_cnt" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_conn_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_conn_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2741,8 +2735,7 @@ smp_fetch_sc_conn_cnt(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* only.
|
* only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_conn_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_conn_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2767,8 +2760,7 @@ smp_fetch_sc_conn_rate(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
* Accepts exactly 1 argument of type table.
|
* Accepts exactly 1 argument of type table.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_src_updt_conn_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_src_updt_conn_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct connection *conn = objt_conn(smp->sess->origin);
|
struct connection *conn = objt_conn(smp->sess->origin);
|
||||||
struct stksess *ts;
|
struct stksess *ts;
|
||||||
@ -2804,8 +2796,7 @@ smp_fetch_src_updt_conn_cnt(unsigned int opt, const struct arg *args, struct sam
|
|||||||
* "src_conn_cur" only.
|
* "src_conn_cur" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_conn_cur(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_conn_cur(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2829,8 +2820,7 @@ smp_fetch_sc_conn_cur(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* "src_sess_cnt" only.
|
* "src_sess_cnt" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_sess_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_sess_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2853,8 +2843,7 @@ smp_fetch_sc_sess_cnt(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* Supports being called as "sc[0-9]_sess_rate" or "src_sess_rate" only.
|
* Supports being called as "sc[0-9]_sess_rate" or "src_sess_rate" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2879,8 +2868,7 @@ smp_fetch_sc_sess_rate(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
* "src_http_req_cnt" only.
|
* "src_http_req_cnt" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_http_req_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_http_req_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2904,8 +2892,7 @@ smp_fetch_sc_http_req_cnt(unsigned int opt, const struct arg *args, struct sampl
|
|||||||
* "src_http_req_rate" only.
|
* "src_http_req_rate" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_http_req_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_http_req_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2930,8 +2917,7 @@ smp_fetch_sc_http_req_rate(unsigned int opt, const struct arg *args, struct samp
|
|||||||
* "src_http_err_cnt" only.
|
* "src_http_err_cnt" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_http_err_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_http_err_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2955,8 +2941,7 @@ smp_fetch_sc_http_err_cnt(unsigned int opt, const struct arg *args, struct sampl
|
|||||||
* "src_http_err_rate" only.
|
* "src_http_err_rate" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_http_err_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_http_err_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -2981,8 +2966,7 @@ smp_fetch_sc_http_err_rate(unsigned int opt, const struct arg *args, struct samp
|
|||||||
* "sc[0-9]_kbytes_in" or "src_kbytes_in" only.
|
* "sc[0-9]_kbytes_in" or "src_kbytes_in" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_kbytes_in(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_kbytes_in(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -3006,8 +2990,7 @@ smp_fetch_sc_kbytes_in(unsigned int opt, const struct arg *args, struct sample *
|
|||||||
* "sc[0-9]_bytes_in_rate" or "src_bytes_in_rate" only.
|
* "sc[0-9]_bytes_in_rate" or "src_bytes_in_rate" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_bytes_in_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_bytes_in_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -3032,8 +3015,7 @@ smp_fetch_sc_bytes_in_rate(unsigned int opt, const struct arg *args, struct samp
|
|||||||
* "sc[0-9]_kbytes_out" or "src_kbytes_out" only.
|
* "sc[0-9]_kbytes_out" or "src_kbytes_out" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_kbytes_out(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_kbytes_out(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -3057,8 +3039,7 @@ smp_fetch_sc_kbytes_out(unsigned int opt, const struct arg *args, struct sample
|
|||||||
* "sc[0-9]_bytes_out_rate" or "src_bytes_out_rate" only.
|
* "sc[0-9]_bytes_out_rate" or "src_bytes_out_rate" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_bytes_out_rate(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_bytes_out_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -3082,8 +3063,7 @@ smp_fetch_sc_bytes_out_rate(unsigned int opt, const struct arg *args, struct sam
|
|||||||
* tracked frontend counters. Supports being called as "sc[0-9]_trackers" only.
|
* tracked frontend counters. Supports being called as "sc[0-9]_trackers" only.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_sc_trackers(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_sc_trackers(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
|
||||||
|
|
||||||
@ -3100,8 +3080,7 @@ smp_fetch_sc_trackers(unsigned int opt, const struct arg *args, struct sample *s
|
|||||||
* Accepts exactly 1 argument of type table.
|
* Accepts exactly 1 argument of type table.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_table_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_table_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
smp->flags = SMP_F_VOL_TEST;
|
smp->flags = SMP_F_VOL_TEST;
|
||||||
smp->type = SMP_T_UINT;
|
smp->type = SMP_T_UINT;
|
||||||
@ -3113,8 +3092,7 @@ smp_fetch_table_cnt(unsigned int opt, const struct arg *args, struct sample *smp
|
|||||||
* Accepts exactly 1 argument of type table.
|
* Accepts exactly 1 argument of type table.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
smp_fetch_table_avl(unsigned int opt, const struct arg *args, struct sample *smp,
|
smp_fetch_table_avl(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
const char *kw, void *private)
|
|
||||||
{
|
{
|
||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user