summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_route.c
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2022-07-14 04:32:49 +0800
committerZhidao HONG <z.hong@f5.com>2022-07-14 04:32:49 +0800
commit45b89e32577eef18e473d0c7ae24562e7efedcc0 (patch)
treed7058ec9ad0fb257897873cc1429182425d17b9b /src/nxt_http_route.c
parent7b80186f097fda3d1c0758a30efa889ec89c5a9d (diff)
downloadunit-45b89e32577eef18e473d0c7ae24562e7efedcc0.tar.gz
unit-45b89e32577eef18e473d0c7ae24562e7efedcc0.tar.bz2
Var: dynamic variables support.
This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
Diffstat (limited to 'src/nxt_http_route.c')
-rw-r--r--src/nxt_http_route.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c
index 5a4f349e..e00c37fe 100644
--- a/src/nxt_http_route.c
+++ b/src/nxt_http_route.c
@@ -643,6 +643,7 @@ nxt_http_action_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_mp_t *mp;
nxt_int_t ret;
nxt_str_t pass;
+ nxt_router_conf_t *rtcf;
nxt_http_action_conf_t acf;
nxt_memzero(&acf, sizeof(acf));
@@ -655,10 +656,11 @@ nxt_http_action_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_memzero(action, sizeof(nxt_http_action_t));
- mp = tmcf->router_conf->mem_pool;
+ rtcf = tmcf->router_conf;
+ mp = rtcf->mem_pool;
if (acf.ret != NULL) {
- return nxt_http_return_init(mp, action, &acf);
+ return nxt_http_return_init(rtcf, action, &acf);
}
if (acf.share != NULL) {
@@ -671,7 +673,7 @@ nxt_http_action_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_conf_get_string(acf.pass, &pass);
- action->u.var = nxt_var_compile(&pass, mp, 0);
+ action->u.var = nxt_var_compile(&pass, mp, rtcf->var_fields, 0);
if (nxt_slow_path(action->u.var == NULL)) {
return NXT_ERROR;
}
@@ -1484,16 +1486,18 @@ nxt_http_action_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
{
nxt_mp_t *mp;
nxt_int_t ret;
+ nxt_router_conf_t *rtcf;
nxt_http_action_t *action;
- mp = tmcf->router_conf->mem_pool;
+ rtcf = tmcf->router_conf;
+ mp = rtcf->mem_pool;
action = nxt_mp_alloc(mp, sizeof(nxt_http_action_t));
if (nxt_slow_path(action == NULL)) {
return NULL;
}
- action->u.var = nxt_var_compile(pass, mp, 0);
+ action->u.var = nxt_var_compile(pass, mp, rtcf->var_fields, 0);
if (nxt_slow_path(action->u.var == NULL)) {
return NULL;
}