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,
21 curl_easy_setopt(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 CUR‐
28 LOPT_RESOLVE(3).
29
30 Disable DOH use again by setting this option to NULL.
31
33 NULL - there is no default DOH URL. If this option isn't set, libcurl
34 will use the default name resolver.
35
37 All
38
40 CURL *curl = curl_easy_init();
41 if(curl) {
42 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
43 curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://dns.example.com");
44 curl_easy_perform(curl);
45 }
46
48 Added in 7.62.0
49
51 Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insuf‐
52 ficient heap space.
53
54 Note that curl_easy_setopt(3) won't actually parse the given string so
55 given a bad DOH URL, curl will not detect a problem until it tries to
56 resolve a name with it.
57
59 CURLOPT_VERBOSE(3), CURLOPT_RESOLVE(3),
60
61
62
63libcurl 7.71.1 June 25, 2020 CURLOPT_DOH_URL(3)