comparison src/http/ngx_http_variables.c @ 540:005a70f9573b NGINX_0_8_16

nginx 0.8.16 *) Feature: the "image_filter_transparency" directive. *) Bugfix: "addition_types" directive was incorrectly named "addtion_types". *) Bugfix: resolver cache poisoning. Thanks to Matthew Dempsky. *) Bugfix: memory leak in resolver. Thanks to Matthew Dempsky. *) Bugfix: invalid request line in $request variable was written in access_log only if error_log was set to "info" or "debug" level. *) Bugfix: in PNG alpha-channel support in the ngx_http_image_filter_module. *) Bugfix: nginx always added "Vary: Accept-Encoding" response header line, if both "gzip_static" and "gzip_vary" were on. *) Bugfix: in UTF-8 encoding support by "try_files" directive in nginx/Windows. *) Bugfix: in "post_action" directive usage; the bug had appeared in 0.8.11. Thanks to Igor Artemiev.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Sep 2009 00:00:00 +0400
parents 499474178a11
children c04fa65fe604
comparison
equal deleted inserted replaced
538:a607f3a5aefe 540:005a70f9573b
22 ngx_http_variable_value_t *v, uintptr_t data); 22 ngx_http_variable_value_t *v, uintptr_t data);
23 23
24 static ngx_int_t ngx_http_variable_unknown_header_in(ngx_http_request_t *r, 24 static ngx_int_t ngx_http_variable_unknown_header_in(ngx_http_request_t *r,
25 ngx_http_variable_value_t *v, uintptr_t data); 25 ngx_http_variable_value_t *v, uintptr_t data);
26 static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r, 26 static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r,
27 ngx_http_variable_value_t *v, uintptr_t data);
28 static ngx_int_t ngx_http_variable_request_line(ngx_http_request_t *r,
27 ngx_http_variable_value_t *v, uintptr_t data); 29 ngx_http_variable_value_t *v, uintptr_t data);
28 static ngx_int_t ngx_http_variable_cookie(ngx_http_request_t *r, 30 static ngx_int_t ngx_http_variable_cookie(ngx_http_request_t *r,
29 ngx_http_variable_value_t *v, uintptr_t data); 31 ngx_http_variable_value_t *v, uintptr_t data);
30 static ngx_int_t ngx_http_variable_argument(ngx_http_request_t *r, 32 static ngx_int_t ngx_http_variable_argument(ngx_http_request_t *r,
31 ngx_http_variable_value_t *v, uintptr_t data); 33 ngx_http_variable_value_t *v, uintptr_t data);
162 164
163 { ngx_string("document_uri"), NULL, ngx_http_variable_request, 165 { ngx_string("document_uri"), NULL, ngx_http_variable_request,
164 offsetof(ngx_http_request_t, uri), 166 offsetof(ngx_http_request_t, uri),
165 NGX_HTTP_VAR_NOCACHEABLE, 0 }, 167 NGX_HTTP_VAR_NOCACHEABLE, 0 },
166 168
167 { ngx_string("request"), NULL, ngx_http_variable_request, 169 { ngx_string("request"), NULL, ngx_http_variable_request_line, 0, 0, 0 },
168 offsetof(ngx_http_request_t, request_line), 0, 0 },
169 170
170 { ngx_string("document_root"), NULL, 171 { ngx_string("document_root"), NULL,
171 ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, 172 ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
172 173
173 { ngx_string("realpath_root"), NULL, 174 { ngx_string("realpath_root"), NULL,
749 return NGX_OK; 750 return NGX_OK;
750 } 751 }
751 752
752 753
753 static ngx_int_t 754 static ngx_int_t
755 ngx_http_variable_request_line(ngx_http_request_t *r,
756 ngx_http_variable_value_t *v, uintptr_t data)
757 {
758 u_char *p, *s;
759
760 s = r->request_line.data;
761
762 if (s == NULL) {
763 s = r->request_start;
764
765 if (s == NULL) {
766 v->not_found = 1;
767 return NGX_OK;
768 }
769
770 for (p = s; p < r->header_in->last; p++) {
771 if (*p == CR || *p == LF) {
772 break;
773 }
774 }
775
776 r->request_line.len = p - s;
777 r->request_line.data = s;
778 }
779
780 v->len = r->request_line.len;
781 v->valid = 1;
782 v->no_cacheable = 0;
783 v->not_found = 0;
784 v->data = s;
785
786 return NGX_OK;
787 }
788
789
790 static ngx_int_t
754 ngx_http_variable_cookie(ngx_http_request_t *r, ngx_http_variable_value_t *v, 791 ngx_http_variable_cookie(ngx_http_request_t *r, ngx_http_variable_value_t *v,
755 uintptr_t data) 792 uintptr_t data)
756 { 793 {
757 ngx_str_t *name = (ngx_str_t *) data; 794 ngx_str_t *name = (ngx_str_t *) data;
758 795