1CURLOPT_SSL_VERIFYHOST(3)  curl_easy_setopt options  CURLOPT_SSL_VERIFYHOST(3)
2
3
4

NAME

6       CURLOPT_SSL_VERIFYHOST - verify the certificate's name against host
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYHOST, long verify);
12

DESCRIPTION

14       Pass a long as parameter specifying what to verify.
15
16       This option determines whether libcurl verifies that the server cert is
17       for the server it is known as.
18
19       When negotiating TLS and SSL connections, the server sends  a  certifi‐
20       cate indicating its identity.
21
22       When  CURLOPT_SSL_VERIFYHOST(3)  is  2,  that certificate must indicate
23       that the server is the server to which you meant  to  connect,  or  the
24       connection  fails. Simply put, it means it has to have the same name in
25       the certificate as is in the URL you operate against.
26
27       Curl considers the server the intended one when the Common  Name  field
28       or  a  Subject Alternate Name field in the certificate matches the host
29       name in the URL to which you told Curl to connect.
30
31       If verify value is set to 1:
32
33       In 7.28.0 and earlier: treated as a debug option  of  some  sorts,  not
34       supported anymore due to frequently leading to programmer mistakes.
35
36       From  7.28.1  to 7.65.3: setting it to 1 made curl_easy_setopt() return
37       an error and leaving the flag untouched.
38
39       From 7.66.0: treats 1 and 2 the same.
40
41       When the verify value is 0, the connection succeeds regardless  of  the
42       names in the certificate. Use that ability with caution!
43
44       The default value for this option is 2.
45
46       This  option controls checking the server's certificate's claimed iden‐
47       tity.   The  server  could  be  lying.   To  control  lying,  see  CUR‐
48       LOPT_SSL_VERIFYPEER(3).
49

LIMITATIONS

51       Secure  Transport: If verify value is 0, then SNI is also disabled. SNI
52       is a TLS extension that sends the hostname to the  server.  The  server
53       may  use  that information to do such things as sending back a specific
54       certificate for the hostname, or forwarding the request to  a  specific
55       origin server. Some hostnames may be inaccessible if SNI is not sent.
56
57       NSS: If CURLOPT_SSL_VERIFYPEER(3) is zero, CURLOPT_SSL_VERIFYHOST(3) is
58       also set to zero and cannot be overridden.
59

DEFAULT

61       2
62

PROTOCOLS

64       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
65

EXAMPLE

67       CURL *curl = curl_easy_init();
68       if(curl) {
69         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
70
71         /* Set the default value: strict name check please */
72         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
73
74         curl_easy_perform(curl);
75       }
76

AVAILABILITY

78       If built TLS enabled.
79

RETURN VALUE

81       Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not.
82
83       If 1 is set as argument, CURLE_BAD_FUNCTION_ARGUMENT is returned.
84

SEE ALSO

86       CURLOPT_SSL_VERIFYPEER(3), CURLOPT_CAINFO(3),
87
88
89
90libcurl 7.85.0                   May 17, 2022        CURLOPT_SSL_VERIFYHOST(3)
Impressum