xref: /curl/docs/libcurl/opts/CURLOPT_PROXYTYPE.md (revision e3fe0200)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXYTYPE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PROXY (3)
9  - CURLOPT_PROXYPORT (3)
10Protocol:
11  - All
12---
13
14# NAME
15
16CURLOPT_PROXYTYPE - proxy protocol type
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYTYPE, long type);
24~~~
25
26# DESCRIPTION
27
28Pass one of the values below to set the type of the proxy.
29
30## CURLPROXY_HTTP
31
32HTTP Proxy. Default.
33
34## CURLPROXY_HTTPS
35
36HTTPS Proxy using HTTP/1. (Added in 7.52.0 for OpenSSL and GnuTLS. Since
377.87.0, it also works for BearSSL, mbedTLS, rustls, Schannel, Secure Transport
38and wolfSSL.)
39
40## CURLPROXY_HTTPS2
41
42HTTPS Proxy and attempt to speak HTTP/2 over it. (Added in 8.1.0)
43
44## CURLPROXY_HTTP_1_0
45
46HTTP 1.0 Proxy. This is similar to CURLPROXY_HTTP except it uses HTTP/1.0 for
47any CONNECT tunneling. It does not change the HTTP version of the actual HTTP
48requests, controlled by CURLOPT_HTTP_VERSION(3).
49
50## CURLPROXY_SOCKS4
51
52SOCKS4 Proxy.
53
54## CURLPROXY_SOCKS4A
55
56SOCKS4a Proxy. Proxy resolves URL hostname.
57
58## CURLPROXY_SOCKS5
59
60SOCKS5 Proxy.
61
62## CURLPROXY_SOCKS5_HOSTNAME
63
64SOCKS5 Proxy. Proxy resolves URL hostname.
65
66Often it is more convenient to specify the proxy type with the scheme part of
67the CURLOPT_PROXY(3) string.
68
69# DEFAULT
70
71CURLPROXY_HTTP
72
73# EXAMPLE
74
75~~~c
76int main(void)
77{
78  CURL *curl = curl_easy_init();
79  if(curl) {
80    CURLcode ret;
81    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
82    curl_easy_setopt(curl, CURLOPT_PROXY, "local.example.com:1080");
83    /* set the proxy type */
84    curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
85    ret = curl_easy_perform(curl);
86    curl_easy_cleanup(curl);
87  }
88}
89~~~
90
91# AVAILABILITY
92
93Always
94
95# RETURN VALUE
96
97Returns CURLE_OK
98