diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2006-08-09 19:56:52 +0000 |
|---|---|---|
| committer | Jonathan Kolb <jon@b0g.us> | 2006-08-09 19:56:52 +0000 |
| commit | eda133b7908937a859040c84e8704afd309206ee (patch) | |
| tree | ec50ae060054101cd07f5fb227e7a29f3f3e8df3 /src/http/ngx_http_variables.c | |
| parent | 90f18dca0931d69c64bd77be57c702de64991e24 (diff) | |
| download | nginx-eda133b7908937a859040c84e8704afd309206ee.tar.gz | |
Changes with nginx 0.3.57 09 Aug 2006v0.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; } |
