diff options
Diffstat (limited to 'src/http/modules/ngx_http_rewrite_module.c')
-rw-r--r-- | src/http/modules/ngx_http_rewrite_module.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c index 693495e3b..c575d4343 100644 --- a/src/http/modules/ngx_http_rewrite_module.c +++ b/src/http/modules/ngx_http_rewrite_module.c @@ -691,7 +691,7 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) if (pclcf->locations.elts == NULL) { if (ngx_array_init(&pclcf->locations, cf->pool, 4, sizeof(void *)) - == NGX_ERROR) + == NGX_ERROR) { return NGX_CONF_ERROR; } @@ -759,6 +759,10 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) if_code->next = (u_char *) lcf->codes->elts + lcf->codes->nelts - (u_char *) if_code; + /* the code array belong to parent block */ + + nlcf->codes = NULL; + return NGX_CONF_OK; } @@ -1048,8 +1052,10 @@ ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - v->handler = ngx_http_rewrite_var; - v->data = index; + if (v->handler == NULL) { + v->handler = ngx_http_rewrite_var; + v->data = index; + } n = ngx_http_script_variables_count(&value[2]); |