1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXY_SSL_VERIFYHOST
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CAINFO (3)
9  - CURLOPT_PROXY_CAINFO (3)
10  - CURLOPT_PROXY_SSL_VERIFYPEER (3)
11  - CURLOPT_SSL_VERIFYPEER (3)
12Protocol:
13  - TLS
14TLS-backend:
15  - All
16Added-in: 7.52.0
17---
18
19# NAME
20
21CURLOPT_PROXY_SSL_VERIFYHOST - verify the proxy certificate's name against host
22
23# SYNOPSIS
24
25~~~c
26#include <curl/curl.h>
27
28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYHOST,
29                          long verify);
30~~~
31
32# DESCRIPTION
33
34Pass a long set to 2L as asking curl to *verify* in the HTTPS proxy's
35certificate name fields against the proxy name.
36
37This option determines whether libcurl verifies that the proxy cert contains
38the correct name for the name it is known as.
39
40When CURLOPT_PROXY_SSL_VERIFYHOST(3) is 2, the proxy certificate must
41indicate that the server is the proxy to which you meant to connect to, or the
42connection fails.
43
44Curl considers the proxy the intended one when the Common Name field or a
45Subject Alternate Name field in the certificate matches the hostname in the
46proxy string which you told curl to use.
47
48If *verify* value is set to 1:
49
50In 7.28.0 and earlier: treated as a debug option of some sorts, not supported
51anymore due to frequently leading to programmer mistakes.
52
53From 7.28.1 to 7.65.3: setting it to 1 made curl_easy_setopt(3) return
54an error and leaving the flag untouched.
55
56From 7.66.0: treats 1 and 2 the same.
57
58When the *verify* value is 0L, the connection succeeds regardless of the
59names used in the certificate. Use that ability with caution!
60
61See also CURLOPT_PROXY_SSL_VERIFYPEER(3) to verify the digital signature
62of the proxy certificate.
63
64# DEFAULT
65
662
67
68# %PROTOCOLS%
69
70# EXAMPLE
71
72~~~c
73int main(void)
74{
75  CURL *curl = curl_easy_init();
76  if(curl) {
77    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
78
79    /* Set the default value: strict name check please */
80    curl_easy_setopt(curl, CURLOPT_PROXY_SSL_VERIFYHOST, 2L);
81
82    curl_easy_perform(curl);
83  }
84}
85~~~
86
87# %AVAILABILITY%
88
89# RETURN VALUE
90
91Returns CURLE_OK if TLS is supported, and CURLE_UNKNOWN_OPTION if not.
92
93If 1 is set as argument, *CURLE_BAD_FUNCTION_ARGUMENT* is returned.
94