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
32 Advanced: The DOH lookups use SSL so some SSL settings from your trans‐
33 fer are inherited. The hostname and peer certificate verification set‐
34 tings are not inherited and can be controlled separately via CUR‐
35 LOPT_DOH_SSL_VERIFYHOST(3) and CURLOPT_DOH_SSL_VERIFYPEER(3). Note
36 CURLOPT_SSL_CTX_FUNCTION(3) is inherited.
37
39 NULL - there is no default DOH URL. If this option isn't set, libcurl
40 will use the default name resolver.
41
43 All
44
46 CURL *curl = curl_easy_init();
47 if(curl) {
48 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
49 curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
50 curl_easy_perform(curl);
51 }
52
54 Added in 7.62.0
55
57 Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insuf‐
58 ficient heap space.
59
60 Note that curl_easy_setopt(3) won't actually parse the given string so
61 given a bad DOH URL, curl will not detect a problem until it tries to
62 resolve a name with it.
63
65 CURLOPT_VERBOSE(3), CURLOPT_RESOLVE(3),
66
67
68
69libcurl 7.76.1 March 04, 2021 CURLOPT_DOH_URL(3)