comparison src/core/ngx_resolver.c @ 7428:cbc5dee8d5d2

Resolver: report SRV resolve failure if all A resolves failed. Previously, if an SRV record was successfully resolved, but all of its A records failed to resolve, NXDOMAIN was returned to the caller, which is considered a successful resolve rather than an error. This could result in losing the result of a previous successful resolve by the caller. Now NXDOMAIN is only returned if at least one A resolve completed with this code. Otherwise the error state of the first A resolve is returned.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 11 Dec 2018 19:41:22 +0300
parents 54683f650cbd
children 571383f75a9a
comparison
equal deleted inserted replaced
7427:81d49f85afed 7428:cbc5dee8d5d2
4264 4264
4265 naddrs += srvs[i].naddrs; 4265 naddrs += srvs[i].naddrs;
4266 } 4266 }
4267 4267
4268 if (naddrs == 0) { 4268 if (naddrs == 0) {
4269 ctx->state = NGX_RESOLVE_NXDOMAIN; 4269 ctx->state = srvs[0].state;
4270
4271 for (i = 0; i < nsrvs; i++) {
4272 if (srvs[i].state == NGX_RESOLVE_NXDOMAIN) {
4273 ctx->state = NGX_RESOLVE_NXDOMAIN;
4274 break;
4275 }
4276 }
4277
4270 ctx->valid = ngx_time() + (r->valid ? r->valid : 10); 4278 ctx->valid = ngx_time() + (r->valid ? r->valid : 10);
4271 4279
4272 ctx->handler(ctx); 4280 ctx->handler(ctx);
4273 return; 4281 return;
4274 } 4282 }