create dummy resolver in http context to inherit it in all servers

This commit is contained in:
Igor Sysoev 2008-03-06 08:48:55 +00:00
parent 73eb97f500
commit f39876c24b

View File

@ -2908,14 +2908,21 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->resolver_timeout, 30000); prev->resolver_timeout, 30000);
if (conf->resolver == NULL) { if (conf->resolver == NULL) {
conf->resolver = prev->resolver;
if (conf->resolver == NULL) { if (prev->resolver == NULL) {
conf->resolver = ngx_resolver_create(cf, NULL);
if (conf->resolver == NULL) { /*
* create dummy resolver in http {} context
* to inherit it in all servers
*/
prev->resolver = ngx_resolver_create(cf, NULL);
if (prev->resolver == NULL) {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
} }
conf->resolver = prev->resolver;
} }
ngx_conf_merge_path_value(conf->client_body_temp_path, ngx_conf_merge_path_value(conf->client_body_temp_path,
@ -3717,6 +3724,10 @@ ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_url_t u; ngx_url_t u;
ngx_str_t *value; ngx_str_t *value;
if (clcf->resolver) {
return "is duplicate";
}
value = cf->args->elts; value = cf->args->elts;
ngx_memzero(&u, sizeof(ngx_url_t)); ngx_memzero(&u, sizeof(ngx_url_t));