]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cares: fix missing lazy init for CURLOPT_DNS_SERVERS
authorStefan Eissing <stefan@eissing.org>
Tue, 22 Apr 2025 09:02:41 +0000 (11:02 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 22 Apr 2025 12:33:41 +0000 (14:33 +0200)
When setting option CURLOPT_DNS_SERVERS, the ares channel was not
properly initialized and the setting failed.

Fixes #17119
Reported-by: calvin2021y on github
Closes #17127

lib/asyn-ares.c

index 80efeeb37c0d78f5e3c85cf301cb85c504fb818a..147b4a743e8221100eef0e81d0bdbff12486751f 100644 (file)
@@ -816,6 +816,10 @@ CURLcode Curl_set_dns_servers(struct Curl_easy *data,
   }
 
 #ifdef HAVE_CARES_SERVERS_CSV
+  result = async_ares_init_lazy(data);
+  if(result)
+    return result;
+
 #ifdef HAVE_CARES_PORTS_CSV
   ares_result = ares_set_servers_ports_csv(ares->channel, servers);
 #else