From c701368bef2ab176e9c12ea25b0a700260ef40a7 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Tue, 22 Sep 2020 22:12:27 +0200 Subject: [PATCH] lib-http: http-client-host - Make sure DNS lookup is performed when host has no IPs. This fixes at least one panic: Panic: file ./http-client-private.h: line 679 (http_client_host_get_ip): assertion failed: (idx < host->shared->ips_count) --- src/lib-http/http-client-host.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib-http/http-client-host.c b/src/lib-http/http-client-host.c index 27126eebdb..2168795b68 100644 --- a/src/lib-http/http-client-host.c +++ b/src/lib-http/http-client-host.c @@ -187,14 +187,15 @@ http_client_host_shared_refresh(struct http_client_host_shared *hshared) if (hshared->dns_lookup != NULL) return -1; - if (hshared->ips_count > 0 && - timeval_cmp(&hshared->ips_timeout, &ioloop_timeval) > 0) - return 0; - - if (hshared->to_idle != NULL) - return 0; + if (hshared->ips_count == 0) { + e_debug(hshared->event, "Need to perform DNS lookup"); + } else { + if (timeval_cmp(&hshared->ips_timeout, &ioloop_timeval) > 0) + return 0; - e_debug(hshared->event, "IPs have expired; need to refresh DNS lookup"); + e_debug(hshared->event, "IPs have expired; " + "need to refresh DNS lookup"); + } http_client_host_shared_lookup(hshared); if (hshared->dns_lookup != NULL) -- 2.47.3