1--- 2c: Copyright (C) Daniel Stenberg, <daniel.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) 13--- 14 15# NAME 16 17CURLOPT_DOH_SSL_VERIFYHOST - verify the hostname in the DoH SSL certificate 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST, 25 long verify); 26~~~ 27 28# DESCRIPTION 29 30Pass a long set to 2L as asking curl to *verify* the DoH (DNS-over-HTTPS) 31server's certificate name fields against the hostname. 32 33This option is the DoH equivalent of CURLOPT_SSL_VERIFYHOST(3) and 34only affects requests to the DoH server. 35 36When CURLOPT_DOH_SSL_VERIFYHOST(3) is 2, the SSL certificate provided by 37the DoH server must indicate that the server name is the same as the server 38name to which you meant to connect to, or the connection fails. 39 40Curl considers the DoH server the intended one when the Common Name field or a 41Subject Alternate Name field in the certificate matches the hostname in the 42DoH URL to which you told Curl to connect. 43 44When the *verify* value is set to 1L it is treated the same as 2L. However 45for consistency with the other *VERIFYHOST* options we suggest use 2 and 46not 1. 47 48When the *verify* value is set to 0L, the connection succeeds regardless of 49the names used in the certificate. Use that ability with caution! 50 51See also CURLOPT_DOH_SSL_VERIFYPEER(3) to verify the digital signature 52of the DoH server certificate. 53 54# DEFAULT 55 562 57 58# PROTOCOLS 59 60DoH 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