Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream_round_robin.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 | a384c60d55f3 |
children | 089a662c17d1 |
comparison
equal
deleted
inserted
replaced
5004:764833756dcd | 5005:c9059bd5445b |
---|---|
159 } | 159 } |
160 | 160 |
161 | 161 |
162 /* an upstream implicitly defined by proxy_pass, etc. */ | 162 /* an upstream implicitly defined by proxy_pass, etc. */ |
163 | 163 |
164 if (us->port == 0 && us->default_port == 0) { | 164 if (us->port == 0) { |
165 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 165 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
166 "no port in upstream \"%V\" in %s:%ui", | 166 "no port in upstream \"%V\" in %s:%ui", |
167 &us->host, us->file_name, us->line); | 167 &us->host, us->file_name, us->line); |
168 return NGX_ERROR; | 168 return NGX_ERROR; |
169 } | 169 } |
170 | 170 |
171 ngx_memzero(&u, sizeof(ngx_url_t)); | 171 ngx_memzero(&u, sizeof(ngx_url_t)); |
172 | 172 |
173 u.host = us->host; | 173 u.host = us->host; |
174 u.port = (in_port_t) (us->port ? us->port : us->default_port); | 174 u.port = us->port; |
175 | 175 |
176 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) { | 176 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) { |
177 if (u.err) { | 177 if (u.err) { |
178 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 178 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
179 "%s in upstream \"%V\" in %s:%ui", | 179 "%s in upstream \"%V\" in %s:%ui", |