Skip to content

CURLOPT_DNS_SERVERS setting cannot be cleared from a reused easy handle #16015

@denizsokmen

Description

@denizsokmen

I did this

I call curl_easy_reset() when the multi interface is done with an easy handle, put it back in a pool and recycle them as more requests are made. I may set CURLOPT_DNS_SERVERS on some of those depending on the situation.

I expected the following

A subsequent call to curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, ""); when reusing or curl_easy_reset() to reset the ares channel to its default settings. However, asyn-ares.c says:

  /* If server is NULL or empty, this would purge all DNS servers
   * from ares library, which will cause any and all queries to fail.
   * So, just return OK if none are configured and do not actually make
   * any changes to c-ares. This lets c-ares use its defaults, which
   * it gets from the OS (for instance from /etc/resolv.conf on Linux).
   */

which is understandable. However, there seems to be no way to clear CURLOPT_DNS_SERVERS from an easy handle unless a brand new one is created, making reuse of the handle impossible.

curl/libcurl version

Any

operating system

Ubuntu 22

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions