diff src/core/ngx_inet.c @ 5005:c9059bd5445b

Fixed "proxy_pass" with IP address and no port (ticket #276). Upstreams created by "proxy_pass" with IP address and no port were broken in 1.3.10, by not initializing port in u->sockaddr. API change: ngx_parse_url() was modified to always initialize port (in u->sockaddr and in u->port), even for the u->no_resolve case; ngx_http_upstream() and ngx_http_upstream_add() were adopted.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 10 Jan 2013 12:58:55 +0000
parents 2677c561127b
children 05ba5bce31e0
line wrap: on
line diff
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -707,11 +707,8 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx
         }
 
         u->no_port = 1;
-
-        if (!u->no_resolve) {
-            u->port = u->default_port;
-            sin->sin_port = htons(u->default_port);
-        }
+        u->port = u->default_port;
+        sin->sin_port = htons(u->default_port);
     }
 
     len = last - host;
@@ -868,11 +865,8 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ng
 
         } else {
             u->no_port = 1;
-
-            if (!u->no_resolve) {
-                u->port = u->default_port;
-                sin6->sin6_port = htons(u->default_port);
-            }
+            u->port = u->default_port;
+            sin6->sin6_port = htons(u->default_port);
         }
     }