diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-08-09 19:59:45 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-08-09 19:59:45 +0000 |
commit | c55a104fcb42f5bbd1fd417dfef5b8696dc81621 (patch) | |
tree | 7f930f05016456e2a57a8d75564c2067b81d9ad4 /src/http/ngx_http_variables.c | |
parent | 8d1728fabad981760233be9925417e9f0c35d5c7 (diff) | |
download | nginx-release-0.3.57.tar.gz nginx-release-0.3.57.zip |
nginx-0.3.57-RELEASE importrelease-0.3.57
*) Feature: the $ssl_client_serial variable.
*) Bugfix: in the "!-e" operator of the "if" directive.
Thanks to Andrian Budanstov.
*) Bugfix: while a client certificate verification nginx did not send
to a client the required certificates information.
*) Bugfix: the $document_root variable did not support the variables in
the "root" directive.
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r-- | src/http/ngx_http_variables.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index f151f8789..d5fbfc9b7 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -137,7 +137,7 @@ static ngx_http_variable_t ngx_http_core_variables[] = { offsetof(ngx_http_request_t, request_line), 0, 0 }, { ngx_string("document_root"), NULL, - ngx_http_variable_document_root, 0, 0, 0 }, + ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHABLE, 0 }, { ngx_string("query_string"), NULL, ngx_http_variable_request, offsetof(ngx_http_request_t, args), @@ -775,15 +775,36 @@ static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { + ngx_str_t path; ngx_http_core_loc_conf_t *clcf; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - v->len = clcf->root.len; - v->valid = 1; - v->no_cachable = 0; - v->not_found = 0; - v->data = clcf->root.data; + if (clcf->root_lengths == NULL) { + v->len = clcf->root.len; + v->valid = 1; + v->no_cachable = 0; + v->not_found = 0; + v->data = clcf->root.data; + + } else { + if (ngx_http_script_run(r, &path, clcf->root_lengths->elts, 0, + clcf->root_values->elts) + == NULL) + { + return NGX_ERROR; + } + + if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path) == NGX_ERROR) { + return NGX_ERROR; + } + + v->len = path.len; + v->valid = 1; + v->no_cachable = 0; + v->not_found = 0; + v->data = path.data; + } return NGX_OK; } |