Mercurial > hg > nginx
diff src/http/modules/ngx_http_rewrite_module.c @ 637:e60fe4cf1d4e release-0.3.40
nginx-0.3.40-RELEASE import
*) Feature: the ngx_http_dav_module supports the MKCOL method.
*) Feature: the "create_full_put_path" directive.
*) Feature: the "$limit_rate" variable.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 19 Apr 2006 15:30:56 +0000 |
parents | 18268abd340c |
children | 5e8fb59c18c1 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_rewrite_module.c +++ b/src/http/modules/ngx_http_rewrite_module.c @@ -74,15 +74,6 @@ static ngx_command_t ngx_http_rewrite_c 0, NULL }, -#if 0 - { ngx_string("valid_referers"), - NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, - ngx_http_rewrite_valid_referers, - NGX_HTTP_LOC_CONF_OFFSET, - 0, - NULL }, -#endif - { ngx_string("set"), NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |NGX_CONF_TAKE2, @@ -879,10 +870,11 @@ ngx_http_rewrite_set(ngx_conf_t *cf, ngx { ngx_http_rewrite_loc_conf_t *lcf = conf; - ngx_int_t index; - ngx_str_t *value; - ngx_http_variable_t *v; - ngx_http_script_var_code_t *var; + ngx_int_t index; + ngx_str_t *value; + ngx_http_variable_t *v; + ngx_http_script_var_code_t *vcode; + ngx_http_script_var_handler_code_t *vhcode; value = cf->args->elts; @@ -905,8 +897,8 @@ ngx_http_rewrite_set(ngx_conf_t *cf, ngx return NGX_CONF_ERROR; } - if (v->handler == NULL) { - v->handler = ngx_http_rewrite_var; + if (v->get_handler == NULL) { + v->get_handler = ngx_http_rewrite_var; v->data = index; } @@ -914,14 +906,28 @@ ngx_http_rewrite_set(ngx_conf_t *cf, ngx return NGX_CONF_ERROR; } - var = ngx_http_script_start_code(cf->pool, &lcf->codes, - sizeof(ngx_http_script_var_code_t)); - if (var == NULL) { + if (v->set_handler) { + vhcode = ngx_http_script_start_code(cf->pool, &lcf->codes, + sizeof(ngx_http_script_var_handler_code_t)); + if (vhcode == NULL) { + return NGX_CONF_ERROR; + } + + vhcode->code = ngx_http_script_var_set_handler_code; + vhcode->handler = v->set_handler; + vhcode->data = v->data; + + return NGX_CONF_OK; + } + + vcode = ngx_http_script_start_code(cf->pool, &lcf->codes, + sizeof(ngx_http_script_var_code_t)); + if (vcode == NULL) { return NGX_CONF_ERROR; } - var->code = ngx_http_script_set_var_code; - var->index = (uintptr_t) index; + vcode->code = ngx_http_script_set_var_code; + vcode->index = (uintptr_t) index; return NGX_CONF_OK; }