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