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