quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_DOH_SSL_VERIFYHOST.md (2342B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_DOH_SSL_VERIFYHOST
      5 Section: 3
      6 Source: libcurl
      7 See-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 Protocol:
     14   - TLS
     15 TLS-backend:
     16   - All
     17 Added-in: 7.76.0
     18 ---
     19 
     20 # NAME
     21 
     22 CURLOPT_DOH_SSL_VERIFYHOST - verify the hostname in the DoH SSL certificate
     23 
     24 # SYNOPSIS
     25 
     26 ~~~c
     27 #include <curl/curl.h>
     28 
     29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYHOST,
     30                           long verify);
     31 ~~~
     32 
     33 # DESCRIPTION
     34 
     35 Pass a long set to 2L as asking curl to *verify* the DoH (DNS-over-HTTPS)
     36 server's certificate name fields against the hostname.
     37 
     38 This option is the DoH equivalent of CURLOPT_SSL_VERIFYHOST(3) and
     39 only affects requests to the DoH server.
     40 
     41 When CURLOPT_DOH_SSL_VERIFYHOST(3) is 2, the SSL certificate provided by
     42 the DoH server must indicate that the server name is the same as the server
     43 name to which you meant to connect to, or the connection fails.
     44 
     45 curl considers the DoH server the intended one when the Common Name field or a
     46 Subject Alternate Name field in the certificate matches the hostname in the
     47 DoH URL to which you told curl to connect.
     48 
     49 When the *verify* value is set to 1L it is treated the same as 2L. However
     50 for consistency with the other *VERIFYHOST* options we suggest use 2 and
     51 not 1.
     52 
     53 When the *verify* value is set to 0L, the connection succeeds regardless of
     54 the names used in the certificate. Use that ability with caution.
     55 
     56 See also CURLOPT_DOH_SSL_VERIFYPEER(3) to verify the digital signature
     57 of the DoH server certificate.
     58 
     59 # DEFAULT
     60 
     61 2
     62 
     63 # %PROTOCOLS%
     64 
     65 # EXAMPLE
     66 
     67 ~~~c
     68 int 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 
     89 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     90 
     91 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     92 libcurl-errors(3).