diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2006-12-12 16:46:16 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2006-12-12 16:46:16 +0000 |
| commit | bf3aaac7ac691d142201daaf7fa687d4760bbf22 (patch) | |
| tree | b8708eb68217a48d66762506c6d78c0b66227ec3 /src/http/ngx_http_upstream_round_robin.c | |
| parent | 63ba5a61b59142048400b0a5e434abb7c7b98e2a (diff) | |
| download | nginx-bf3aaac7ac691d142201daaf7fa687d4760bbf22.tar.gz nginx-bf3aaac7ac691d142201daaf7fa687d4760bbf22.tar.bz2 | |
rewritten upstream
Diffstat (limited to 'src/http/ngx_http_upstream_round_robin.c')
| -rw-r--r-- | src/http/ngx_http_upstream_round_robin.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c index 82173e4b0..89937efde 100644 --- a/src/http/ngx_http_upstream_round_robin.c +++ b/src/http/ngx_http_upstream_round_robin.c @@ -61,10 +61,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, /* an upstream implicitly defined by proxy_pass, etc. */ + if (us->port == 0 && us->default_port == 0) { + ngx_log_error(NGX_LOG_EMERG, cf->log, 0, + "no port in upstream \"%V\" in %s:%ui", + &us->host, us->file_name.data, us->line); + return NGX_ERROR; + } + ngx_memzero(&u, sizeof(ngx_url_t)); u.host = us->host; - u.portn = us->port; + u.port = us->port ? us->port : us->default_port; if (ngx_inet_resolve_host(cf, &u) != NGX_OK) { if (u.err) { @@ -76,13 +83,6 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, return NGX_ERROR; } - if (us->port == 0) { - ngx_log_error(NGX_LOG_EMERG, cf->log, 0, - "no port in upstream \"%V\" in %s:%ui", - &us->host, us->file_name.data, us->line); - return NGX_ERROR; - } - n = u.naddrs; peers = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peers_t) |
