summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_variables.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-07-02 14:42:08 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-07-02 14:42:08 +0000
commite5ae5b6890c2c6b2276f4a124d82648b76f9ec7a (patch)
tree7fde3508d97e9d60926ea3626feffd03e7bea637 /src/http/ngx_http_variables.c
parent917e4ab3fb3759e3c9436256d35a1d6cf6169619 (diff)
downloadnginx-e5ae5b6890c2c6b2276f4a124d82648b76f9ec7a.tar.gz
nginx-e5ae5b6890c2c6b2276f4a124d82648b76f9ec7a.tar.bz2
Merge of r4642:
Fixed core variables dynamic access after reconfiguration. If variable was indexed in previous configuration but not in current one, the NGX_HTTP_VAR_INDEXED flag was left set and confused ngx_http_get_variable(). Patch by Yichun Zhang (agentzh), slightly modified.
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r--src/http/ngx_http_variables.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index 949cef910..d9633990c 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -2016,7 +2016,7 @@ ngx_int_t
ngx_http_variables_add_core_vars(ngx_conf_t *cf)
{
ngx_int_t rc;
- ngx_http_variable_t *v;
+ ngx_http_variable_t *cv, *v;
ngx_http_core_main_conf_t *cmcf;
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
@@ -2036,7 +2036,14 @@ ngx_http_variables_add_core_vars(ngx_conf_t *cf)
return NGX_ERROR;
}
- for (v = ngx_http_core_variables; v->name.len; v++) {
+ for (cv = ngx_http_core_variables; cv->name.len; cv++) {
+ v = ngx_palloc(cf->pool, sizeof(ngx_http_variable_t));
+ if (v == NULL) {
+ return NGX_ERROR;
+ }
+
+ *v = *cv;
+
rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v,
NGX_HASH_READONLY_KEY);