diff src/http/ngx_http_upstream.c @ 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 f0b62d1ac7af
children bd1222fb0192
line wrap: on
line diff
--- 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_
             }
         }
 
+        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);