cares: fix missing lazy init for CURLOPT_DNS_SERVERS

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
This commit is contained in:
Stefan Eissing 2025-04-22 11:02:41 +02:00 committed by Daniel Stenberg
parent 4872dafd80
commit 24dd825ed5
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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