summaryrefslogtreecommitdiffhomepage
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.c15
1 files changed, 8 insertions, 7 deletions
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;