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
16---
17
18# NAME
19
20CURLOPT_PROXY_SSL_VERIFYHOST - verify the proxy certificate's name against host
21
22# SYNOPSIS
23
24~~~c
25#include <curl/curl.h>
26
27CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYHOST,
28                          long verify);
29~~~
30
31# DESCRIPTION
32
33Pass a long set to 2L as asking curl to *verify* in the HTTPS proxy's
34certificate name fields against the proxy name.
35
36This option determines whether libcurl verifies that the proxy cert contains
37the correct name for the name it is known as.
38
39When CURLOPT_PROXY_SSL_VERIFYHOST(3) is 2, the proxy certificate must
40indicate that the server is the proxy to which you meant to connect to, or the
41connection fails.
42
43Curl considers the proxy the intended one when the Common Name field or a
44Subject Alternate Name field in the certificate matches the hostname in the
45proxy string which you told curl to use.
46
47If *verify* value is set to 1:
48
49In 7.28.0 and earlier: treated as a debug option of some sorts, not supported
50anymore due to frequently leading to programmer mistakes.
51
52From 7.28.1 to 7.65.3: setting it to 1 made curl_easy_setopt(3) return
53an error and leaving the flag untouched.
54
55From 7.66.0: treats 1 and 2 the same.
56
57When the *verify* value is 0L, the connection succeeds regardless of the
58names used in the certificate. Use that ability with caution!
59
60See also CURLOPT_PROXY_SSL_VERIFYPEER(3) to verify the digital signature
61of the proxy certificate.
62
63# DEFAULT
64
652
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