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
12       verify);
13

DESCRIPTION

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

LIMITATIONS

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

DEFAULT

58       2
59

PROTOCOLS

61       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
62

EXAMPLE

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

AVAILABILITY

75       If built TLS enabled.
76

RETURN VALUE

78       Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not.
79
80       If 1 is set as argument, CURLE_BAD_FUNCTION_ARGUMENT is returned.
81

SEE ALSO

83       CURLOPT_SSL_VERIFYPEER(3), CURLOPT_CAINFO(3),
84
85
86
87libcurl 7.61.1                 February 02, 2017     CURLOPT_SSL_VERIFYHOST(3)
Impressum