diff options
| author | Ruslan Ermilov <ru@nginx.com> | 2014-06-20 12:55:41 +0400 |
|---|---|---|
| committer | Ruslan Ermilov <ru@nginx.com> | 2014-06-20 12:55:41 +0400 |
| commit | 02e39a3ecb27c015662391eedc51dc1d7db27239 (patch) | |
| tree | 45a2c4d81e8135dd1d61b11a3743abaa2564cc51 /src | |
| parent | 80e5163f649015fddd0713099adaa63caa1d722f (diff) | |
| download | nginx-02e39a3ecb27c015662391eedc51dc1d7db27239.tar.gz nginx-02e39a3ecb27c015662391eedc51dc1d7db27239.tar.bz2 | |
Upstream: reduced diffs to the plus version of nginx.
No functional changes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/ngx_http_upstream.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 8b6d3f69f..f7ac4a4eb 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -4851,6 +4851,12 @@ ngx_http_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) } } + uscf->servers = ngx_array_create(cf->pool, 4, + sizeof(ngx_http_upstream_server_t)); + if (uscf->servers == NULL) { + return NGX_CONF_ERROR; + } + /* parse inside upstream{} */ @@ -4866,7 +4872,7 @@ ngx_http_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) return rv; } - if (uscf->servers == NULL) { + if (uscf->servers->nelts == 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "no servers are inside upstream"); return NGX_CONF_ERROR; @@ -4888,14 +4894,6 @@ ngx_http_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_uint_t i; ngx_http_upstream_server_t *us; - if (uscf->servers == NULL) { - uscf->servers = ngx_array_create(cf->pool, 4, - sizeof(ngx_http_upstream_server_t)); - if (uscf->servers == NULL) { - return NGX_CONF_ERROR; - } - } - us = ngx_array_push(uscf->servers); if (us == NULL) { return NGX_CONF_ERROR; @@ -4905,20 +4903,6 @@ ngx_http_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) value = cf->args->elts; - ngx_memzero(&u, sizeof(ngx_url_t)); - - u.url = value[1]; - u.default_port = 80; - - if (ngx_parse_url(cf->pool, &u) != NGX_OK) { - if (u.err) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "%s in upstream \"%V\"", u.err, &u.url); - } - - return NGX_CONF_ERROR; - } - weight = 1; max_fails = 1; fail_timeout = 10; @@ -4998,6 +4982,20 @@ ngx_http_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) goto invalid; } + ngx_memzero(&u, sizeof(ngx_url_t)); + + u.url = value[1]; + u.default_port = 80; + + if (ngx_parse_url(cf->pool, &u) != NGX_OK) { + if (u.err) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "%s in upstream \"%V\"", u.err, &u.url); + } + + return NGX_CONF_ERROR; + } + us->name = u.url; us->addrs = u.addrs; us->naddrs = u.naddrs; |
