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.
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 9aec689..7757ab7 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -707,11 +707,8 @@
}
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 @@
} 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);
}
}