diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-04-04 14:43:21 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-04-04 14:43:21 +0400 |
commit | fde7d51392598d0fa74dca125883d9663e7eb80a (patch) | |
tree | fbde480f7a1eddb2091efcf5543624e89c04ace6 /src | |
parent | 450c981ab968c073049aea7f16dad0134701a403 (diff) |
fix case when a host in fastcgi_pass, scgi_pass, and uwsgi_pass
is given by expression and refers to a defined upstream
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_fastcgi_module.c | 7 | ||||
-rw-r--r-- | src/http/modules/ngx_http_scgi_module.c | 7 | ||||
-rw-r--r-- | src/http/modules/ngx_http_uwsgi_module.c | 7 | ||||
-rw-r--r-- | src/http/ngx_http_upstream.c | 8 |
4 files changed, 11 insertions, 18 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c index 12a1e81d8..12d5b1d8f 100644 --- a/src/http/modules/ngx_http_fastcgi_module.c +++ b/src/http/modules/ngx_http_fastcgi_module.c @@ -636,12 +636,6 @@ ngx_http_fastcgi_eval(ngx_http_request_t *r, ngx_http_fastcgi_loc_conf_t *flcf) 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 @@ ngx_http_fastcgi_eval(ngx_http_request_t *r, ngx_http_fastcgi_loc_conf_t *flcf) } else { u->resolved->host = url.host; u->resolved->port = url.port; + u->resolved->no_port = url.no_port; } return NGX_OK; diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c index d831e27c2..d745551f2 100644 --- a/src/http/modules/ngx_http_scgi_module.c +++ b/src/http/modules/ngx_http_scgi_module.c @@ -458,12 +458,6 @@ ngx_http_scgi_eval(ngx_http_request_t *r, ngx_http_scgi_loc_conf_t * scf) 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 @@ ngx_http_scgi_eval(ngx_http_request_t *r, ngx_http_scgi_loc_conf_t * scf) } else { u->resolved->host = url.host; u->resolved->port = url.port; + u->resolved->no_port = url.no_port; } return NGX_OK; diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c index a2529131b..cd3c7c124 100644 --- a/src/http/modules/ngx_http_uwsgi_module.c +++ b/src/http/modules/ngx_http_uwsgi_module.c @@ -491,12 +491,6 @@ ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf) 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 @@ ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf) } else { u->resolved->host = url.host; u->resolved->port = url.port; + u->resolved->no_port = url.no_port; } return NGX_OK; diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index e8d87738f..dc2d0c0fe 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -574,6 +574,14 @@ ngx_http_upstream_init_request(ngx_http_request_t *r) } } + 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); |