diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-03-28 14:43:02 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-03-28 14:43:02 +0000 |
commit | c04deca88f2b3b99b615571b447d7ecbb6a79bee (patch) | |
tree | 79cedaf8b0e94ca35296e47fa7dd0d29a94bbda9 /src/http/modules/proxy/ngx_http_proxy_upstream.c | |
parent | c4d120bb4378dbd1fbb9f1e2d7930feab6c2ecf2 (diff) | |
download | nginx-release-0.1.27.tar.gz nginx-release-0.1.27.zip |
nginx-0.1.27-RELEASE importrelease-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.
Diffstat (limited to 'src/http/modules/proxy/ngx_http_proxy_upstream.c')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_upstream.c | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c index 45dc04d70..107aba3df 100644 --- a/src/http/modules/proxy/ngx_http_proxy_upstream.c +++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c @@ -86,7 +86,7 @@ int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p) static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) { - size_t len, loc_len; + size_t len; ngx_uint_t i, escape, *index; ngx_buf_t *b; ngx_chain_t *chain; @@ -95,7 +95,6 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) ngx_http_request_t *r; ngx_http_variable_t *var; ngx_http_variable_value_t *value; - ngx_http_core_loc_conf_t *clcf; ngx_http_core_main_conf_t *cmcf; ngx_http_proxy_upstream_conf_t *uc; @@ -107,32 +106,30 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) index = NULL; #endif + escape = 0; + if (p->upstream->method) { - len = http_methods[p->upstream->method - 1].len; + len = http_methods[p->upstream->method - 1].len + uc->uri.len; } else { - len = r->method_name.len; + len = r->method_name.len + uc->uri.len; } - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + if (p->lcf->pass_unparsed_uri && r->valid_unparsed_uri) { + len += r->unparsed_uri.len - 1; -#if (NGX_PCRE) - loc_len = (clcf->regex) ? 1 : clcf->name.len; -#else - loc_len = clcf->name.len; -#endif - - if (r->quoted_uri) { - escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len, - r->uri.len - loc_len, NGX_ESCAPE_URI); } else { - escape = 0; + if (r->quoted_uri) { + escape = 2 * ngx_escape_uri(NULL, r->uri.data + uc->location->len, + r->uri.len - uc->location->len, + NGX_ESCAPE_URI); + } + + len += r->uri.len - uc->location->len + escape + + sizeof("?") - 1 + r->args.len; } - len += uc->uri.len - + r->uri.len - loc_len + escape - + sizeof("?") - 1 + r->args.len - + sizeof(http_version) - 1 + len += sizeof(http_version) - 1 + sizeof(connection_close_header) - 1 + sizeof(CRLF) - 1; @@ -269,19 +266,24 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) b->last = ngx_cpymem(b->last, uc->uri.data, uc->uri.len); - if (escape) { - ngx_escape_uri(b->last, r->uri.data + loc_len, - r->uri.len - loc_len, NGX_ESCAPE_URI); - b->last += r->uri.len - loc_len + escape; - + if (p->lcf->pass_unparsed_uri && r->valid_unparsed_uri) { + b->last = ngx_cpymem(b->last, r->unparsed_uri.data + 1, + r->unparsed_uri.len - 1); } else { - b->last = ngx_cpymem(b->last, r->uri.data + loc_len, - r->uri.len - loc_len); - } + if (escape) { + ngx_escape_uri(b->last, r->uri.data + uc->location->len, + r->uri.len - uc->location->len, NGX_ESCAPE_URI); + b->last += r->uri.len - uc->location->len + escape; + + } else { + b->last = ngx_cpymem(b->last, r->uri.data + uc->location->len, + r->uri.len - uc->location->len); + } - if (r->args.len > 0) { - *b->last++ = '?'; - b->last = ngx_cpymem(b->last, r->args.data, r->args.len); + if (r->args.len > 0) { + *b->last++ = '?'; + b->last = ngx_cpymem(b->last, r->args.data, r->args.len); + } } b->last = ngx_cpymem(b->last, http_version, sizeof(http_version) - 1); |