1CURLOPT_DOH_SSL_VERIFYHOST(3c)url_easy_setopt optionCsURLOPT_DOH_SSL_VERIFYHOST(3)
2
3
4
6 CURLOPT_DOH_SSL_VERIFYHOST - verify the host name in the DoH SSL cer‐
7 tificate
8
10 #include <curl/curl.h>
11
12 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST,
13 long verify);
14
16 Pass a long set to 2L as asking curl to verify the DoH (DNS-over-HTTPS)
17 server's certificate name fields against the host name.
18
19 This option is the DoH equivalent of CURLOPT_SSL_VERIFYHOST(3) and only
20 affects requests to the DoH server.
21
22 When CURLOPT_DOH_SSL_VERIFYHOST(3) is 2, the SSL certificate provided
23 by the DoH server must indicate that the server name is the same as the
24 server name to which you meant to connect to, or the connection fails.
25
26 Curl considers the DoH server the intended one when the Common Name
27 field or a Subject Alternate Name field in the certificate matches the
28 host name in the DoH URL to which you told Curl to connect.
29
30 When the verify value is set to 1L it is treated the same as 2L. How‐
31 ever for consistency with the other VERIFYHOST options we suggest use 2
32 and not 1.
33
34 When the verify value is set to 0L, the connection succeeds regardless
35 of the names used in the certificate. Use that ability with caution!
36
37 See also CURLOPT_DOH_SSL_VERIFYPEER(3) to verify the digital signature
38 of the DoH server certificate. If libcurl is built against NSS and
39 CURLOPT_DOH_SSL_VERIFYPEER(3) is zero, CURLOPT_DOH_SSL_VERIFYHOST(3) is
40 also set to zero and cannot be overridden.
41
43 2
44
46 DoH
47
49 CURL *curl = curl_easy_init();
50 if(curl) {
51 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
52
53 curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://cloudflare-dns.com/dns-query");
54
55 /* Disable host name verification of the DoH server */
56 curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L);
57
58 curl_easy_perform(curl);
59 }
60
62 Added in 7.76.0
63
64 If built TLS enabled.
65
67 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
68 if not.
69
71 CURLOPT_DOH_SSL_VERIFYPEER(3), CURLOPT_SSL_VERIFYHOST(3), CUR‐
72 LOPT_SSL_VERIFYPEER(3), CURLOPT_PROXY_SSL_VERIFYPEER(3), CUR‐
73 LOPT_PROXY_SSL_VERIFYHOST(3),
74
75
76
77libcurl 7.82.0 November 26, 2021 CURLOPT_DOH_SSL_VERIFYHOST(3)