1CURLOPT_DNS_SERVERS(3)     curl_easy_setopt options     CURLOPT_DNS_SERVERS(3)
2
3
4

NAME

6       CURLOPT_DNS_SERVERS - DNS servers to use
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode   curl_easy_setopt(CURL   *handle,  CURLOPT_DNS_SERVERS,  char
12       *servers);
13

DESCRIPTION

15       Pass a char * that is the list of DNS servers to be used instead of the
16       system default. The format of the dns servers option is:
17
18       host[:port][,host[:port]]...
19
20       For example:
21
22       192.168.1.100,192.168.1.101,3.4.5.6
23
24       The  application  does not have to keep the string around after setting
25       this option.
26

DEFAULT

28       NULL - use system default
29

PROTOCOLS

31       All
32

EXAMPLE

34       CURL *curl = curl_easy_init();
35       if(curl) {
36         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
37         curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, "192.168.1.100:53,192.168.1.101");
38         ret = curl_easy_perform(curl);
39         curl_easy_cleanup(curl);
40       }
41

AVAILABILITY

43       This option requires that libcurl was built  with  a  resolver  backend
44       that supports this operation. The c-ares backend is the only such one.
45
46       Added in 7.24.0
47

RETURN VALUE

49       Returns  CURLE_OK  if  the option is supported, CURLE_UNKNOWN_OPTION if
50       not,  CURLE_NOT_BUILT_IN  if  support  was  disabled  at  compile-time,
51       CURLE_BAD_FUNCTION_ARGUMENT  when  given  an  invalid  server  list, or
52       CURLE_OUT_OF_MEMORY if there was insufficient heap space.
53

SEE ALSO

55       CURLOPT_DNS_LOCAL_IP4(3), CURLOPT_DNS_CACHE_TIMEOUT(3),
56
57
58
59libcurl 7.79.1                September 08, 2021        CURLOPT_DNS_SERVERS(3)
Impressum