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