aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2011-10-24 16:09:05 +0000
committerIgor Sysoev <igor@sysoev.ru>2011-10-24 16:09:05 +0000
commit620718102bb0ee6c4abfb4a736db596a6b0e0183 (patch)
tree7a48f827bbad9d8535c7109ee75461461ce69e96 /src/http/ngx_http_core_module.c
parentba71972b2132282e028971c0f6d9da65ae87e92a (diff)
downloadnginx-620718102bb0ee6c4abfb4a736db596a6b0e0183.tar.gz
nginx-620718102bb0ee6c4abfb4a736db596a6b0e0183.zip
Support of several servers in the "resolver" directive.
Patch by Kirill A. Korinskiy.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index c6909cd2e..7c4442265 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -718,7 +718,7 @@ static ngx_command_t ngx_http_core_commands[] = {
NULL },
{ ngx_string("resolver"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
ngx_http_core_resolver,
NGX_HTTP_LOC_CONF_OFFSET,
0,
@@ -3535,7 +3535,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
* to inherit it in all servers
*/
- prev->resolver = ngx_resolver_create(cf, NULL);
+ prev->resolver = ngx_resolver_create(cf, NULL, 0);
if (prev->resolver == NULL) {
return NGX_CONF_ERROR;
}
@@ -4540,7 +4540,6 @@ ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_core_loc_conf_t *clcf = conf;
- ngx_url_t u;
ngx_str_t *value;
if (clcf->resolver) {
@@ -4549,19 +4548,9 @@ ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts;
- ngx_memzero(&u, sizeof(ngx_url_t));
-
- u.host = value[1];
- u.port = 53;
-
- if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err);
- return NGX_CONF_ERROR;
- }
-
- clcf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
+ clcf->resolver = ngx_resolver_create(cf, &value[1], cf->args->nelts - 1);
if (clcf->resolver == NULL) {
- return NGX_OK;
+ return NGX_CONF_ERROR;
}
return NGX_CONF_OK;