diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-12-03 10:05:19 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-12-03 10:05:19 +0000 |
| commit | 6b2fce430b4cdb063b5b4e5382515d384c90272b (patch) | |
| tree | b96e96db97ccb66acfc5aba3a4e1734df1c0b39d /src/http | |
| parent | 26aae392f9fd35c840bf8e400b7f4defacf181ab (diff) | |
| download | nginx-6b2fce430b4cdb063b5b4e5382515d384c90272b.tar.gz nginx-6b2fce430b4cdb063b5b4e5382515d384c90272b.tar.bz2 | |
allow to use IP addresses without defined resolver
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/ngx_http_core_module.c | 7 | ||||
| -rw-r--r-- | src/http/ngx_http_upstream.c | 15 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index fea5cb5b5..b882f1c2f 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -2594,6 +2594,13 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) if (conf->resolver == NULL) { conf->resolver = prev->resolver; + + if (conf->resolver == NULL) { + conf->resolver = ngx_resolver_create(NULL, cf->cycle->new_log); + if (conf->resolver == NULL) { + return NGX_OK; + } + } } ngx_conf_merge_path_value(conf->client_body_temp_path, diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 7901bb667..e51638b56 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -398,13 +398,6 @@ ngx_http_upstream_init(ngx_http_request_t *r) } } - if (clcf->resolver == NULL) { - ngx_log_error(NGX_LOG_ERR, c->log, 0, - "no resolver defined to resolve %V", host); - ngx_http_finalize_request(r, NGX_HTTP_BAD_GATEWAY); - return; - } - temp.name = *host; ctx = ngx_resolve_start(clcf->resolver, &temp); @@ -413,6 +406,14 @@ ngx_http_upstream_init(ngx_http_request_t *r) return; } + if (ctx == NGX_NO_RESOLVER) { + ngx_log_error(NGX_LOG_ERR, c->log, 0, + "no resolver defined to resolve %V", host); + + ngx_http_finalize_request(r, NGX_HTTP_BAD_GATEWAY); + return; + } + ctx->name = *host; ctx->type = NGX_RESOLVE_A; ctx->handler = ngx_http_upstream_resolve_handler; |
