1CURLOPT_PRE_PROXY(3)                libcurl               CURLOPT_PRE_PROXY(3)
2
3
4

NAME

6       CURLOPT_PRE_PROXY - pre-proxy host to use
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRE_PROXY, char *preproxy);
12

DESCRIPTION

14       Set  the preproxy to use for the upcoming request. The parameter should
15       be a char * to a null-terminated string holding the host name or dotted
16       numerical  IP  address. A numerical IPv6 address must be written within
17       [brackets].
18
19       To specify port number in this string, append :[port] to the end of the
20       host name. The proxy's port number may optionally be specified with the
21       separate option CURLOPT_PROXYPORT(3). If not  specified,  libcurl  will
22       default to using port 1080 for proxies.
23
24       A  pre  proxy is a SOCKS proxy that curl connects to before it connects
25       to the HTTP(S) proxy specified in the  CURLOPT_PROXY  option.  The  pre
26       proxy can only be a SOCKS proxy.
27
28       The  pre  proxy  string  should be prefixed with [scheme]:// to specify
29       which kind of socks is used. Use socks4://,  socks4a://,  socks5://  or
30       socks5h://  (the  last  one to enable socks5 and asking the proxy to do
31       the resolving, also known as CURLPROXY_SOCKS5_HOSTNAME type) to request
32       the  specific SOCKS version to be used. Otherwise SOCKS4 is used as de‐
33       fault.
34
35       Setting the pre proxy string to "" (an empty  string)  will  explicitly
36       disable the use of a pre proxy.
37
38       The  application  does not have to keep the string around after setting
39       this option.
40

DEFAULT

42       Default is NULL, meaning no pre proxy is used.
43
44       When you set a host name to use, do not assume that there's any partic‐
45       ular single port number used widely for proxies. Specify it!
46

PROTOCOLS

48       All  except  file://.  Note  that  some protocols do not work well over
49       proxy.
50

EXAMPLE

52       CURL *curl = curl_easy_init();
53       if(curl) {
54         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
55         curl_easy_setopt(curl, CURLOPT_PRE_PROXY, "socks4://socks-proxy:1080");
56         curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
57         curl_easy_perform(curl);
58       }
59

AVAILABILITY

61       Added in 7.52.0
62

RETURN VALUE

64       Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not,
65       or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
66

SEE ALSO

68       CURLOPT_PROXY(3), CURLOPT_HTTPPROXYTUNNEL(3),
69
70
71
72ibcurl 8.2.1                    April 26, 2023            CURLOPT_PRE_PROXY(3)
Impressum