Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 3272:98f49b2bcae8
change ngx_parse_addr() interface
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Nov 2009 16:11:06 +0000 |
parents | fcd98af88df3 |
children | 479468a7d982 |
comparison
equal
deleted
inserted
replaced
3271:fcd98af88df3 | 3272:98f49b2bcae8 |
---|---|
4202 ngx_http_upsteam_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, | 4202 ngx_http_upsteam_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, |
4203 void *conf) | 4203 void *conf) |
4204 { | 4204 { |
4205 char *p = conf; | 4205 char *p = conf; |
4206 | 4206 |
4207 ngx_int_t rc; | |
4207 ngx_str_t *value; | 4208 ngx_str_t *value; |
4208 ngx_addr_t **paddr; | 4209 ngx_addr_t **paddr; |
4209 | 4210 |
4210 paddr = (ngx_addr_t **) (p + cmd->offset); | 4211 paddr = (ngx_addr_t **) (p + cmd->offset); |
4211 | 4212 |
4213 *paddr = ngx_palloc(cf->pool, sizeof(ngx_addr_t)); | |
4214 if (*paddr == NULL) { | |
4215 return NGX_CONF_ERROR; | |
4216 } | |
4217 | |
4212 value = cf->args->elts; | 4218 value = cf->args->elts; |
4213 | 4219 |
4214 *paddr = ngx_parse_addr(cf->pool, &value[1]); | 4220 rc = ngx_parse_addr(cf->pool, *paddr, value[1].data, value[1].len); |
4215 if (*paddr) { | 4221 |
4222 switch (rc) { | |
4223 case NGX_OK: | |
4224 (*paddr)->name = value[1]; | |
4216 return NGX_CONF_OK; | 4225 return NGX_CONF_OK; |
4217 } | 4226 |
4218 | 4227 case NGX_DECLINED: |
4219 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 4228 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4220 "invalid address \"%V\"", &value[1]); | 4229 "invalid address \"%V\"", &value[1]); |
4221 | 4230 default: |
4222 return NGX_CONF_ERROR; | 4231 return NGX_CONF_ERROR; |
4232 } | |
4223 } | 4233 } |
4224 | 4234 |
4225 | 4235 |
4226 ngx_int_t | 4236 ngx_int_t |
4227 ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf, | 4237 ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf, |