comparison src/http/ngx_http_variables.c @ 671:cec32b3753ac release-0.3.57

nginx-0.3.57-RELEASE import *) 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.
author Igor Sysoev <igor@sysoev.ru>
date Wed, 09 Aug 2006 19:59:45 +0000
parents 63a820b0bc6c
children 44161d685b8a
comparison
equal deleted inserted replaced
670:ba43c68592d0 671:cec32b3753ac
135 135
136 { ngx_string("request"), NULL, ngx_http_variable_request, 136 { ngx_string("request"), NULL, ngx_http_variable_request,
137 offsetof(ngx_http_request_t, request_line), 0, 0 }, 137 offsetof(ngx_http_request_t, request_line), 0, 0 },
138 138
139 { ngx_string("document_root"), NULL, 139 { ngx_string("document_root"), NULL,
140 ngx_http_variable_document_root, 0, 0, 0 }, 140 ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHABLE, 0 },
141 141
142 { ngx_string("query_string"), NULL, ngx_http_variable_request, 142 { ngx_string("query_string"), NULL, ngx_http_variable_request,
143 offsetof(ngx_http_request_t, args), 143 offsetof(ngx_http_request_t, args),
144 NGX_HTTP_VAR_NOCACHABLE, 0 }, 144 NGX_HTTP_VAR_NOCACHABLE, 0 },
145 145
773 773
774 static ngx_int_t 774 static ngx_int_t
775 ngx_http_variable_document_root(ngx_http_request_t *r, 775 ngx_http_variable_document_root(ngx_http_request_t *r,
776 ngx_http_variable_value_t *v, uintptr_t data) 776 ngx_http_variable_value_t *v, uintptr_t data)
777 { 777 {
778 ngx_str_t path;
778 ngx_http_core_loc_conf_t *clcf; 779 ngx_http_core_loc_conf_t *clcf;
779 780
780 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 781 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
781 782
782 v->len = clcf->root.len; 783 if (clcf->root_lengths == NULL) {
783 v->valid = 1; 784 v->len = clcf->root.len;
784 v->no_cachable = 0; 785 v->valid = 1;
785 v->not_found = 0; 786 v->no_cachable = 0;
786 v->data = clcf->root.data; 787 v->not_found = 0;
788 v->data = clcf->root.data;
789
790 } else {
791 if (ngx_http_script_run(r, &path, clcf->root_lengths->elts, 0,
792 clcf->root_values->elts)
793 == NULL)
794 {
795 return NGX_ERROR;
796 }
797
798 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path) == NGX_ERROR) {
799 return NGX_ERROR;
800 }
801
802 v->len = path.len;
803 v->valid = 1;
804 v->no_cachable = 0;
805 v->not_found = 0;
806 v->data = path.data;
807 }
787 808
788 return NGX_OK; 809 return NGX_OK;
789 } 810 }
790 811
791 812