1CURLOPT_DOH_URL(3) curl_easy_setopt options CURLOPT_DOH_URL(3)
2
3
4
6 CURLOPT_DOH_URL - provide the DNS-over-HTTPS URL
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_URL, char *URL);
12
14 Pass in a pointer to a URL for the DoH server to use for name resolv‐
15 ing. The parameter should be a char * to a null-terminated string which
16 must be URL-encoded in the following format: "https://host:port/path".
17 It MUST specify a HTTPS URL.
18
19 libcurl doesn't validate the syntax or use this variable until the
20 transfer is issued. Even if you set a crazy value here, curl_easy_se‐
21 topt(3) will still return CURLE_OK.
22
23 curl sends POST requests to the given DNS-over-HTTPS URL.
24
25 To find the DoH server itself, which might be specified using a name,
26 libcurl will use the default name lookup function. You can bootstrap
27 that by providing the address for the DoH server with CURLOPT_RE‐
28 SOLVE(3).
29
30 Disable DoH use again by setting this option to NULL.
31
33 DoH lookups use SSL and some SSL settings from your transfer are inher‐
34 ited, like CURLOPT_SSL_CTX_FUNCTION(3).
35
36 The hostname and peer certificate verification settings are not inher‐
37 ited but can be controlled separately via CURLOPT_DOH_SSL_VERIFYHOST(3)
38 and CURLOPT_DOH_SSL_VERIFYPEER(3).
39
40 A set CURLOPT_OPENSOCKETFUNCTION(3) callback is not inherited.
41
43 NULL - there is no default DoH URL. If this option isn't set, libcurl
44 will use the default name resolver.
45
47 All
48
50 CURL *curl = curl_easy_init();
51 if(curl) {
52 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
53 curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
54 curl_easy_perform(curl);
55 }
56
58 Added in 7.62.0
59
61 Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insuf‐
62 ficient heap space.
63
64 Note that curl_easy_setopt(3) won't actually parse the given string so
65 given a bad DoH URL, curl will not detect a problem until it tries to
66 resolve a name with it.
67
69 CURLOPT_VERBOSE(3), CURLOPT_RESOLVE(3),
70
71
72
73libcurl 7.79.1 July 28, 2021 CURLOPT_DOH_URL(3)