1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_DOH_SSL_VERIFYHOST
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_DOH_SSL_VERIFYPEER (3)
9  - CURLOPT_PROXY_SSL_VERIFYHOST (3)
10  - CURLOPT_PROXY_SSL_VERIFYPEER (3)
11  - CURLOPT_SSL_VERIFYHOST (3)
12  - CURLOPT_SSL_VERIFYPEER (3)
13Protocol:
14  - TLS
15TLS-backend:
16  - All
17---
18
19# NAME
20
21CURLOPT_DOH_SSL_VERIFYHOST - verify the hostname in the DoH SSL certificate
22
23# SYNOPSIS
24
25~~~c
26#include <curl/curl.h>
27
28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST,
29                          long verify);
30~~~
31
32# DESCRIPTION
33
34Pass a long set to 2L as asking curl to *verify* the DoH (DNS-over-HTTPS)
35server's certificate name fields against the hostname.
36
37This option is the DoH equivalent of CURLOPT_SSL_VERIFYHOST(3) and
38only affects requests to the DoH server.
39
40When CURLOPT_DOH_SSL_VERIFYHOST(3) is 2, the SSL certificate provided by
41the DoH server must indicate that the server name is the same as the server
42name to which you meant to connect to, or the connection fails.
43
44Curl considers the DoH server the intended one when the Common Name field or a
45Subject Alternate Name field in the certificate matches the hostname in the
46DoH URL to which you told Curl to connect.
47
48When the *verify* value is set to 1L it is treated the same as 2L. However
49for consistency with the other *VERIFYHOST* options we suggest use 2 and
50not 1.
51
52When the *verify* value is set to 0L, the connection succeeds regardless of
53the names used in the certificate. Use that ability with caution!
54
55See also CURLOPT_DOH_SSL_VERIFYPEER(3) to verify the digital signature
56of the DoH server certificate.
57
58# DEFAULT
59
602
61
62# EXAMPLE
63
64~~~c
65int main(void)
66{
67  CURL *curl = curl_easy_init();
68  if(curl) {
69    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
70
71    curl_easy_setopt(curl, CURLOPT_DOH_URL,
72                     "https://cloudflare-dns.com/dns-query");
73
74    /* Disable host name verification of the DoH server */
75    curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYHOST, 0L);
76
77    curl_easy_perform(curl);
78  }
79}
80~~~
81
82# AVAILABILITY
83
84Added in 7.76.0
85
86If built TLS enabled.
87
88# RETURN VALUE
89
90Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
91