Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 54:bcb5fce0b038 NGINX_0_1_27
nginx 0.1.27
*) Feature: the "blocked" parameter of the "valid_referers" directive.
*) Change: the errors while handling the request header now logged at
"info" level. The server name and the "Host" and "Referer" header
lines also logged.
*) Change: the "Host" header line is also logged in error log.
*) Feature: the proxy_pass_unparsed_uri directive. The special handling
of the "://" symbols in URI, appeared in 0.1.11 version, now is
canceled.
*) Bugfix: nginx could not be built on FreeBSD and Linux, if the
--without-ngx_http_auth_basic_module configuration parameter was
used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 28 Mar 2005 00:00:00 +0400 |
parents | 72eb30262aac |
children |
comparison
equal
deleted
inserted
replaced
53:b6565ddf033b | 54:bcb5fce0b038 |
---|---|
84 } | 84 } |
85 | 85 |
86 | 86 |
87 static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) | 87 static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) |
88 { | 88 { |
89 size_t len, loc_len; | 89 size_t len; |
90 ngx_uint_t i, escape, *index; | 90 ngx_uint_t i, escape, *index; |
91 ngx_buf_t *b; | 91 ngx_buf_t *b; |
92 ngx_chain_t *chain; | 92 ngx_chain_t *chain; |
93 ngx_list_part_t *part; | 93 ngx_list_part_t *part; |
94 ngx_table_elt_t *header; | 94 ngx_table_elt_t *header; |
95 ngx_http_request_t *r; | 95 ngx_http_request_t *r; |
96 ngx_http_variable_t *var; | 96 ngx_http_variable_t *var; |
97 ngx_http_variable_value_t *value; | 97 ngx_http_variable_value_t *value; |
98 ngx_http_core_loc_conf_t *clcf; | |
99 ngx_http_core_main_conf_t *cmcf; | 98 ngx_http_core_main_conf_t *cmcf; |
100 ngx_http_proxy_upstream_conf_t *uc; | 99 ngx_http_proxy_upstream_conf_t *uc; |
101 | 100 |
102 r = p->request; | 101 r = p->request; |
103 uc = p->lcf->upstream; | 102 uc = p->lcf->upstream; |
105 #if (NGX_SUPPRESS_WARN) | 104 #if (NGX_SUPPRESS_WARN) |
106 var = NULL; | 105 var = NULL; |
107 index = NULL; | 106 index = NULL; |
108 #endif | 107 #endif |
109 | 108 |
109 escape = 0; | |
110 | |
110 if (p->upstream->method) { | 111 if (p->upstream->method) { |
111 len = http_methods[p->upstream->method - 1].len; | 112 len = http_methods[p->upstream->method - 1].len + uc->uri.len; |
112 | 113 |
113 } else { | 114 } else { |
114 len = r->method_name.len; | 115 len = r->method_name.len + uc->uri.len; |
115 } | 116 } |
116 | 117 |
117 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 118 if (p->lcf->pass_unparsed_uri && r->valid_unparsed_uri) { |
118 | 119 len += r->unparsed_uri.len - 1; |
119 #if (NGX_PCRE) | 120 |
120 loc_len = (clcf->regex) ? 1 : clcf->name.len; | |
121 #else | |
122 loc_len = clcf->name.len; | |
123 #endif | |
124 | |
125 if (r->quoted_uri) { | |
126 escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len, | |
127 r->uri.len - loc_len, NGX_ESCAPE_URI); | |
128 } else { | 121 } else { |
129 escape = 0; | 122 if (r->quoted_uri) { |
130 } | 123 escape = 2 * ngx_escape_uri(NULL, r->uri.data + uc->location->len, |
131 | 124 r->uri.len - uc->location->len, |
132 len += uc->uri.len | 125 NGX_ESCAPE_URI); |
133 + r->uri.len - loc_len + escape | 126 } |
134 + sizeof("?") - 1 + r->args.len | 127 |
135 + sizeof(http_version) - 1 | 128 len += r->uri.len - uc->location->len + escape |
129 + sizeof("?") - 1 + r->args.len; | |
130 } | |
131 | |
132 len += sizeof(http_version) - 1 | |
136 + sizeof(connection_close_header) - 1 | 133 + sizeof(connection_close_header) - 1 |
137 + sizeof(CRLF) - 1; | 134 + sizeof(CRLF) - 1; |
138 | 135 |
139 | 136 |
140 if (p->lcf->set_x_url) { | 137 if (p->lcf->set_x_url) { |
267 b->last = ngx_cpymem(b->last, r->method_name.data, r->method_name.len); | 264 b->last = ngx_cpymem(b->last, r->method_name.data, r->method_name.len); |
268 } | 265 } |
269 | 266 |
270 b->last = ngx_cpymem(b->last, uc->uri.data, uc->uri.len); | 267 b->last = ngx_cpymem(b->last, uc->uri.data, uc->uri.len); |
271 | 268 |
272 if (escape) { | 269 if (p->lcf->pass_unparsed_uri && r->valid_unparsed_uri) { |
273 ngx_escape_uri(b->last, r->uri.data + loc_len, | 270 b->last = ngx_cpymem(b->last, r->unparsed_uri.data + 1, |
274 r->uri.len - loc_len, NGX_ESCAPE_URI); | 271 r->unparsed_uri.len - 1); |
275 b->last += r->uri.len - loc_len + escape; | |
276 | |
277 } else { | 272 } else { |
278 b->last = ngx_cpymem(b->last, r->uri.data + loc_len, | 273 if (escape) { |
279 r->uri.len - loc_len); | 274 ngx_escape_uri(b->last, r->uri.data + uc->location->len, |
280 } | 275 r->uri.len - uc->location->len, NGX_ESCAPE_URI); |
281 | 276 b->last += r->uri.len - uc->location->len + escape; |
282 if (r->args.len > 0) { | 277 |
283 *b->last++ = '?'; | 278 } else { |
284 b->last = ngx_cpymem(b->last, r->args.data, r->args.len); | 279 b->last = ngx_cpymem(b->last, r->uri.data + uc->location->len, |
280 r->uri.len - uc->location->len); | |
281 } | |
282 | |
283 if (r->args.len > 0) { | |
284 *b->last++ = '?'; | |
285 b->last = ngx_cpymem(b->last, r->args.data, r->args.len); | |
286 } | |
285 } | 287 } |
286 | 288 |
287 b->last = ngx_cpymem(b->last, http_version, sizeof(http_version) - 1); | 289 b->last = ngx_cpymem(b->last, http_version, sizeof(http_version) - 1); |
288 | 290 |
289 | 291 |