]> git.kaiwu.me - nginx.git/commitdiff
inherit $memached_key index and memcached_pass upstream inside "if" block
authorIgor Sysoev <igor@sysoev.ru>
Thu, 27 Dec 2007 14:18:34 +0000 (14:18 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 27 Dec 2007 14:18:34 +0000 (14:18 +0000)
src/http/modules/ngx_http_memcached_module.c

index dbca81a7d8dc7ac86ff823f88f08638fe3818812..76a37e169496b93294ef1f1c00df87cb16e2f9db 100644 (file)
@@ -524,8 +524,6 @@ ngx_http_memcached_create_loc_conf(ngx_conf_t *cf)
      *     conf->upstream.schema = { 0, NULL };
      *     conf->upstream.uri = { 0, NULL };
      *     conf->upstream.location = NULL;
-     *
-     *     conf->index = 0;
      */
 
     conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
@@ -548,6 +546,8 @@ ngx_http_memcached_create_loc_conf(ngx_conf_t *cf)
     conf->upstream.pass_request_headers = 0;
     conf->upstream.pass_request_body = 0;
 
+    conf->index = NGX_CONF_UNSET;
+
     return conf;
 }
 
@@ -582,6 +582,15 @@ ngx_http_memcached_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
                                        |NGX_HTTP_UPSTREAM_FT_OFF;
     }
 
+    if (conf->upstream.upstream == NULL) {
+        conf->upstream.upstream = prev->upstream.upstream;
+        conf->upstream.schema = prev->upstream.schema;
+    }
+
+    if (conf->index == NGX_CONF_UNSET) {
+        conf->index = prev->index;
+    }
+
     return NGX_CONF_OK;
 }