summaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_memcached_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules/ngx_http_memcached_module.c')
-rw-r--r--src/http/modules/ngx_http_memcached_module.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c
index dbca81a7d..1f156cd42 100644
--- a/src/http/modules/ngx_http_memcached_module.c
+++ b/src/http/modules/ngx_http_memcached_module.c
@@ -58,7 +58,7 @@ static ngx_conf_bitmask_t ngx_http_memcached_next_upstream_masks[] = {
static ngx_command_t ngx_http_memcached_commands[] = {
{ ngx_string("memcached_pass"),
- NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1,
ngx_http_memcached_pass,
NGX_HTTP_LOC_CONF_OFFSET,
0,
@@ -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;
}