Mercurial > hg > nginx
diff src/http/modules/ngx_http_proxy_module.c @ 1671:8075179cae21
ngx_parse_url() saves port text, this allows to use it in proxy host header
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 28 Nov 2007 19:55:31 +0000 |
parents | e9bd042134cb |
children | ca317d9b5c09 |
line wrap: on
line diff
--- 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 } } 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 {