Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-11-28 22:55:31 +0300
committerIgor Sysoev <igor@sysoev.ru>2007-11-28 22:55:31 +0300
commit00e0377488de41471d666dc6fac62f822de4fc18 (patch)
tree1d2f1fe18538d30c4f73c6ebd48826ba743f89b7 /src/http/modules/ngx_http_proxy_module.c
parent57bb3498441ce8c14c083bbb98b8ad13aba60ecf (diff)
ngx_parse_url() saves port text, this allows to use it in proxy host header
Diffstat (limited to 'src/http/modules/ngx_http_proxy_module.c')
-rw-r--r--src/http/modules/ngx_http_proxy_module.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 69a12e0fc..977de4641 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2645,8 +2645,6 @@ static ngx_int_t
ngx_http_proxy_set_vars(ngx_pool_t *pool, ngx_url_t *u,
ngx_http_proxy_vars_t *v)
{
- u_char *p;
-
if (!u->unix_socket) {
if (u->no_port || u->port == u->default_port) {
v->host_header = u->host;
@@ -2661,16 +2659,9 @@ ngx_http_proxy_set_vars(ngx_pool_t *pool, ngx_url_t *u,
}
} else {
- p = ngx_palloc(pool, u->host.len + sizeof(":65536") - 1);
- if (p == NULL) {
- return NGX_ERROR;
- }
-
- v->host_header.len = ngx_sprintf(p, "%V:%d", &u->host, u->port) - p;
- v->host_header.data = p;
-
- v->port.len = v->host_header.len - u->host.len - 1;
- v->port.data = p + u->host.len + 1;
+ v->host_header.len = u->host.len + 1 + u->port_text.len;
+ v->host_header.data = u->host.data;
+ v->port = u->port_text;
}
} else {