Mercurial > hg > nginx
changeset 3879:502a6b0acf3f
fix case when a host in fastcgi_pass, scgi_pass, and uwsgi_pass
is given by expression and refers to a defined upstream
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 04 Apr 2011 10:43:21 +0000 |
parents | 7562ee4feb74 |
children | e3cb8e27e413 |
files | src/http/modules/ngx_http_fastcgi_module.c src/http/modules/ngx_http_scgi_module.c src/http/modules/ngx_http_uwsgi_module.c src/http/ngx_http_upstream.c |
diffstat | 4 files changed, 11 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_fastcgi_module.c Mon Apr 04 09:57:32 2011 +0000 +++ b/src/http/modules/ngx_http_fastcgi_module.c Mon Apr 04 10:43:21 2011 +0000 @@ -636,12 +636,6 @@ return NGX_ERROR; } - if (url.no_port) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no port in upstream \"%V\"", &url.url); - return NGX_ERROR; - } - u = r->upstream; u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t)); @@ -658,6 +652,7 @@ } else { u->resolved->host = url.host; u->resolved->port = url.port; + u->resolved->no_port = url.no_port; } return NGX_OK;
--- a/src/http/modules/ngx_http_scgi_module.c Mon Apr 04 09:57:32 2011 +0000 +++ b/src/http/modules/ngx_http_scgi_module.c Mon Apr 04 10:43:21 2011 +0000 @@ -458,12 +458,6 @@ return NGX_ERROR; } - if (url.no_port) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no port in upstream \"%V\"", &url.url); - return NGX_ERROR; - } - u = r->upstream; u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t)); @@ -480,6 +474,7 @@ } else { u->resolved->host = url.host; u->resolved->port = url.port; + u->resolved->no_port = url.no_port; } return NGX_OK;
--- a/src/http/modules/ngx_http_uwsgi_module.c Mon Apr 04 09:57:32 2011 +0000 +++ b/src/http/modules/ngx_http_uwsgi_module.c Mon Apr 04 10:43:21 2011 +0000 @@ -491,12 +491,6 @@ return NGX_ERROR; } - if (url.no_port) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no port in upstream \"%V\"", &url.url); - return NGX_ERROR; - } - u = r->upstream; u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t)); @@ -513,6 +507,7 @@ } else { u->resolved->host = url.host; u->resolved->port = url.port; + u->resolved->no_port = url.no_port; } return NGX_OK;
--- a/src/http/ngx_http_upstream.c Mon Apr 04 09:57:32 2011 +0000 +++ b/src/http/ngx_http_upstream.c Mon Apr 04 10:43:21 2011 +0000 @@ -574,6 +574,14 @@ } } + if (u->resolved->port == 0) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "no port in upstream \"%V\"", host); + ngx_http_upstream_finalize_request(r, u, + NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + temp.name = *host; ctx = ngx_resolve_start(clcf->resolver, &temp);