1CURLOPT_DNS_SERVERS(3) curl_easy_setopt options CURLOPT_DNS_SERVERS(3)
2
3
4
6 CURLOPT_DNS_SERVERS - DNS servers to use
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SERVERS, char *servers);
12
14 Pass a char * that is the list of DNS servers to be used instead of the
15 system default. The format of the dns servers option is:
16
17 host[:port][,host[:port]]...
18
19 For example:
20
21 192.168.1.100,192.168.1.101,3.4.5.6
22
23 The application does not have to keep the string around after setting
24 this option.
25
27 NULL - use system default
28
30 All
31
33 CURL *curl = curl_easy_init();
34 if(curl) {
35 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
36 curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, "192.168.1.100:53,192.168.1.101");
37 ret = curl_easy_perform(curl);
38 curl_easy_cleanup(curl);
39 }
40
42 This option requires that libcurl was built with a resolver backend
43 that supports this operation. The c-ares backend is the only such one.
44
45 Added in 7.24.0
46
48 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
49 not, CURLE_NOT_BUILT_IN if support was disabled at compile-time,
50 CURLE_BAD_FUNCTION_ARGUMENT when given an invalid server list, or
51 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
52
54 CURLOPT_DNS_LOCAL_IP4(3), CURLOPT_DNS_CACHE_TIMEOUT(3),
55
56
57
58libcurl 7.85.0 May 17, 2022 CURLOPT_DNS_SERVERS(3)