Mercurial > hg > nginx-vendor-1-0
comparison src/http/ngx_http_variables.c @ 412:b246022ef454 NGINX_0_7_18
nginx 0.7.18
*) Change: the "underscores_in_headers" directive; now nginx does not
allows underscores in a client request header line names.
*) Feature: the ngx_http_secure_link_module.
*) Feature: the "real_ip_header" directive supports any header.
*) Feature: the "log_subrequest" directive.
*) Feature: the $realpath_root variable.
*) Feature: the "http_502" and "http_504" parameters of the
"proxy_next_upstream" directive.
*) Bugfix: the "http_503" parameter of the "proxy_next_upstream" or
"fastcgi_next_upstream" directives did not work.
*) Bugfix: nginx might send a "Transfer-Encoding: chunked" heaer line
for HEAD requests.
*) Bugfix: now accept threshold depends on worker_connections.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 13 Oct 2008 00:00:00 +0400 |
parents | a8e3f1441eec |
children | ad0a34a8efa6 |
comparison
equal
deleted
inserted
replaced
411:b453a4324c60 | 412:b246022ef454 |
---|---|
43 static ngx_int_t ngx_http_variable_scheme(ngx_http_request_t *r, | 43 static ngx_int_t ngx_http_variable_scheme(ngx_http_request_t *r, |
44 ngx_http_variable_value_t *v, uintptr_t data); | 44 ngx_http_variable_value_t *v, uintptr_t data); |
45 static ngx_int_t ngx_http_variable_is_args(ngx_http_request_t *r, | 45 static ngx_int_t ngx_http_variable_is_args(ngx_http_request_t *r, |
46 ngx_http_variable_value_t *v, uintptr_t data); | 46 ngx_http_variable_value_t *v, uintptr_t data); |
47 static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r, | 47 static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r, |
48 ngx_http_variable_value_t *v, uintptr_t data); | |
49 static ngx_int_t ngx_http_variable_realpath_root(ngx_http_request_t *r, | |
48 ngx_http_variable_value_t *v, uintptr_t data); | 50 ngx_http_variable_value_t *v, uintptr_t data); |
49 static ngx_int_t ngx_http_variable_request_filename(ngx_http_request_t *r, | 51 static ngx_int_t ngx_http_variable_request_filename(ngx_http_request_t *r, |
50 ngx_http_variable_value_t *v, uintptr_t data); | 52 ngx_http_variable_value_t *v, uintptr_t data); |
51 static ngx_int_t ngx_http_variable_server_name(ngx_http_request_t *r, | 53 static ngx_int_t ngx_http_variable_server_name(ngx_http_request_t *r, |
52 ngx_http_variable_value_t *v, uintptr_t data); | 54 ngx_http_variable_value_t *v, uintptr_t data); |
160 offsetof(ngx_http_request_t, request_line), 0, 0 }, | 162 offsetof(ngx_http_request_t, request_line), 0, 0 }, |
161 | 163 |
162 { ngx_string("document_root"), NULL, | 164 { ngx_string("document_root"), NULL, |
163 ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, | 165 ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, |
164 | 166 |
167 { ngx_string("realpath_root"), NULL, | |
168 ngx_http_variable_realpath_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
169 | |
165 { ngx_string("query_string"), NULL, ngx_http_variable_request, | 170 { ngx_string("query_string"), NULL, ngx_http_variable_request, |
166 offsetof(ngx_http_request_t, args), | 171 offsetof(ngx_http_request_t, args), |
167 NGX_HTTP_VAR_NOCACHEABLE, 0 }, | 172 NGX_HTTP_VAR_NOCACHEABLE, 0 }, |
168 | 173 |
169 { ngx_string("args"), | 174 { ngx_string("args"), |
998 return NGX_OK; | 1003 return NGX_OK; |
999 } | 1004 } |
1000 | 1005 |
1001 | 1006 |
1002 static ngx_int_t | 1007 static ngx_int_t |
1008 ngx_http_variable_realpath_root(ngx_http_request_t *r, | |
1009 ngx_http_variable_value_t *v, uintptr_t data) | |
1010 { | |
1011 size_t len; | |
1012 ngx_str_t path; | |
1013 ngx_http_core_loc_conf_t *clcf; | |
1014 u_char real[NGX_MAX_PATH]; | |
1015 | |
1016 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1017 | |
1018 if (clcf->root_lengths == NULL) { | |
1019 path = clcf->root; | |
1020 | |
1021 } else { | |
1022 if (ngx_http_script_run(r, &path, clcf->root_lengths->elts, 1, | |
1023 clcf->root_values->elts) | |
1024 == NULL) | |
1025 { | |
1026 return NGX_ERROR; | |
1027 } | |
1028 | |
1029 path.data[path.len - 1] = '\0'; | |
1030 | |
1031 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0) | |
1032 == NGX_ERROR) | |
1033 { | |
1034 return NGX_ERROR; | |
1035 } | |
1036 } | |
1037 | |
1038 if (ngx_realpath(path.data, real) == NULL) { | |
1039 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | |
1040 ngx_realpath_n " \"%s\" failed", path.data); | |
1041 return NGX_ERROR; | |
1042 } | |
1043 | |
1044 len = ngx_strlen(real); | |
1045 | |
1046 v->data = ngx_pnalloc(r->pool, len); | |
1047 if (v->data == NULL) { | |
1048 return NGX_ERROR; | |
1049 } | |
1050 | |
1051 v->len = len; | |
1052 v->valid = 1; | |
1053 v->no_cacheable = 0; | |
1054 v->not_found = 0; | |
1055 | |
1056 ngx_memcpy(v->data, real, len); | |
1057 | |
1058 return NGX_OK; | |
1059 } | |
1060 | |
1061 | |
1062 static ngx_int_t | |
1003 ngx_http_variable_request_filename(ngx_http_request_t *r, | 1063 ngx_http_variable_request_filename(ngx_http_request_t *r, |
1004 ngx_http_variable_value_t *v, uintptr_t data) | 1064 ngx_http_variable_value_t *v, uintptr_t data) |
1005 { | 1065 { |
1006 size_t root; | 1066 size_t root; |
1007 ngx_str_t path; | 1067 ngx_str_t path; |