| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <[email protected]>, et al. |
| 9 |
.\" * |
| 10 |
.\" * This software is licensed as described in the file COPYING, which |
| 11 |
.\" * you should have received as part of this distribution. The terms |
| 12 |
.\" * are also available at https://curl.haxx.se/docs/copyright.html. |
| 13 |
.\" * |
| 14 |
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 |
.\" * copies of the Software, and permit persons to whom the Software is |
| 16 |
.\" * furnished to do so, under the terms of the COPYING file. |
| 17 |
.\" * |
| 18 |
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 |
.\" * KIND, either express or implied. |
| 20 |
.\" * |
| 21 |
.\" ************************************************************************** |
| 22 |
.\" |
| 23 |
.TH CURLOPT_PRE_PROXY 3 "16 Nov 2016" "libcurl 7.52.0" "curl_easy_setopt options" |
| 24 |
.SH NAME |
| 25 |
CURLOPT_PRE_PROXY \- set pre-proxy to use |
| 26 |
.SH SYNOPSIS |
| 27 |
#include <curl/curl.h> |
| 28 |
|
| 29 |
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRE_PROXY, char *preproxy); |
| 30 |
.SH DESCRIPTION |
| 31 |
Set the \fIpreproxy\fP to use for the upcoming request. The parameter |
| 32 |
should be a char * to a zero terminated string holding the host name or dotted |
| 33 |
numerical IP address. A numerical IPv6 address must be written within |
| 34 |
[brackets]. |
| 35 |
|
| 36 |
To specify port number in this string, append :[port] to the end of the host |
| 37 |
name. The proxy's port number may optionally be specified with the separate |
| 38 |
option \fICURLOPT_PROXYPORT(3)\fP. If not specified, libcurl will default to |
| 39 |
using port 1080 for proxies. |
| 40 |
|
| 41 |
A pre proxy is a SOCKS proxy that curl connects to before it connects to the |
| 42 |
HTTP(S) proxy specified in the \fICURLOPT_PROXY\fP option. The pre proxy can |
| 43 |
only be a SOCKS proxy. |
| 44 |
|
| 45 |
The pre proxy string should be prefixed with [scheme]:// to specify which kind |
| 46 |
of socks is used. Use socks4://, socks4a://, socks5:// or socks5h:// (the last |
| 47 |
one to enable socks5 and asking the proxy to do the resolving, also known as |
| 48 |
\fICURLPROXY_SOCKS5_HOSTNAME\fP type) to request the specific SOCKS version to |
| 49 |
be used. Otherwise SOCKS4 is used as default. |
| 50 |
|
| 51 |
Setting the pre proxy string to "" (an empty string) will explicitly disable |
| 52 |
the use of a pre proxy. |
| 53 |
|
| 54 |
The application does not have to keep the string around after setting this |
| 55 |
option. |
| 56 |
.SH DEFAULT |
| 57 |
Default is NULL, meaning no pre proxy is used. |
| 58 |
|
| 59 |
When you set a host name to use, do not assume that there's any particular |
| 60 |
single port number used widely for proxies. Specify it! |
| 61 |
.SH PROTOCOLS |
| 62 |
All except file://. Note that some protocols don't do very well over proxy. |
| 63 |
.SH EXAMPLE |
| 64 |
.nf |
| 65 |
CURL *curl = curl_easy_init(); |
| 66 |
if(curl) { |
| 67 |
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/file.txt"); |
| 68 |
curl_easy_setopt(curl, CURLOPT_PREPROXY, "socks4://socks-proxy:1080"); |
| 69 |
curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80"); |
| 70 |
curl_easy_perform(curl); |
| 71 |
} |
| 72 |
.fi |
| 73 |
.SH AVAILABILITY |
| 74 |
Added in 7.52.0 |
| 75 |
.SH RETURN VALUE |
| 76 |
Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or |
| 77 |
CURLE_OUT_OF_MEMORY if there was insufficient heap space. |
| 78 |
.SH "SEE ALSO" |
| 79 |
.BR CURLOPT_PROXY "(3), " CURLOPT_HTTPPROXYTUNNEL "(3), " |