aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-03-03 20:04:06 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-03-03 20:04:06 +0000
commit8efe926dc5601397bc054aedf37594e9719a52f6 (patch)
tree2ec892df84a3f43ba31d77e326f53747049cd744 /src
parent85d6a3e3dbe3ecfb3ae1dce05ec2bfde8bca0f4b (diff)
downloadnginx-8efe926dc5601397bc054aedf37594e9719a52f6.tar.gz
nginx-8efe926dc5601397bc054aedf37594e9719a52f6.zip
fix r1903
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_proxy_module.c1
-rw-r--r--src/http/ngx_http_upstream.c3
-rw-r--r--src/http/ngx_http_upstream.h1
3 files changed, 4 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index d3f4c60ea..83eeac647 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -611,6 +611,7 @@ ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx,
r->upstream->resolved->host = u.host;
r->upstream->resolved->port = (in_port_t) (u.no_port ? u.default_port:
u.port);
+ r->upstream->resolved->default_port = u.default_port;
return NGX_OK;
}
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index a46b819a4..241277902 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -392,7 +392,8 @@ ngx_http_upstream_init(ngx_http_request_t *r)
uscf = uscfp[i];
if (uscf->host.len == host->len
- && uscf->port == u->resolved->port
+ && ((uscf->port == 0 && u->resolved->default_port)
+ || uscf->port == u->resolved->port)
&& ngx_memcmp(uscf->host.data, host->data, host->len) == 0)
{
goto found;
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index 15615caec..2ed2797a2 100644
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -201,6 +201,7 @@ typedef struct {
typedef struct {
ngx_str_t host;
in_port_t port;
+ ngx_uint_t default_port; /* unsigned default_port:1 */
ngx_uint_t naddrs;
in_addr_t *addrs;
ngx_resolver_ctx_t *ctx;