xref: /curl/docs/libcurl/opts/CURLOPT_PROXYTYPE.md (revision 24b66a1d)
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
66##
67
68Often it is more convenient to specify the proxy type with the scheme part of
69the CURLOPT_PROXY(3) string.
70
71# DEFAULT
72
73CURLPROXY_HTTP
74
75# EXAMPLE
76
77~~~c
78int main(void)
79{
80  CURL *curl = curl_easy_init();
81  if(curl) {
82    CURLcode ret;
83    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
84    curl_easy_setopt(curl, CURLOPT_PROXY, "local.example.com:1080");
85    /* set the proxy type */
86    curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
87    ret = curl_easy_perform(curl);
88    curl_easy_cleanup(curl);
89  }
90}
91~~~
92
93# AVAILABILITY
94
95Always
96
97# RETURN VALUE
98
99Returns CURLE_OK
100