[nginx] svn commit: r4714 - in branches/stable-1.2: . src/http

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Jul 2 14:42:09 UTC 2012


Author: mdounin
Date: 2012-07-02 14:42:08 +0000 (Mon, 02 Jul 2012)
New Revision: 4714
URL: http://trac.nginx.org/nginx/changeset/4714/nginx

Log:
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.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/ngx_http_variables.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-06-29 20:33:26 UTC (rev 4713)
+++ branches/stable-1.2	2012-07-02 14:42:08 UTC (rev 4714)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4641,4645,4674-4676
+/trunk:4611-4632,4636-4642,4645,4674-4676
\ No newline at end of property
Modified: branches/stable-1.2/src/http/ngx_http_variables.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_variables.c	2012-06-29 20:33:26 UTC (rev 4713)
+++ branches/stable-1.2/src/http/ngx_http_variables.c	2012-07-02 14:42:08 UTC (rev 4714)
@@ -2016,7 +2016,7 @@
 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 @@
         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);
 



More information about the nginx-devel mailing list