aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index a04aad323..b82bfa97b 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -4204,22 +4204,32 @@ ngx_http_upsteam_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
{
char *p = conf;
+ ngx_int_t rc;
ngx_str_t *value;
ngx_addr_t **paddr;
paddr = (ngx_addr_t **) (p + cmd->offset);
+ *paddr = ngx_palloc(cf->pool, sizeof(ngx_addr_t));
+ if (*paddr == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
value = cf->args->elts;
- *paddr = ngx_parse_addr(cf->pool, &value[1]);
- if (*paddr) {
- return NGX_CONF_OK;
- }
+ rc = ngx_parse_addr(cf->pool, *paddr, value[1].data, value[1].len);
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid address \"%V\"", &value[1]);
+ switch (rc) {
+ case NGX_OK:
+ (*paddr)->name = value[1];
+ return NGX_CONF_OK;
- return NGX_CONF_ERROR;
+ case NGX_DECLINED:
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid address \"%V\"", &value[1]);
+ default:
+ return NGX_CONF_ERROR;
+ }
}