64b74faedd426307881e8bf7b75b0d1465c505f3
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_PROXY.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, 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_PROXY 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
24 .SH NAME
25 CURLOPT_PROXY \- set proxy to use
26 .SH SYNOPSIS
27 #include <curl/curl.h>
28
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY, char *proxy);
30 .SH DESCRIPTION
31 Set the \fIproxy\fP to use for the upcoming request. The parameter should be a
32 char * to a zero terminated string holding the host name or dotted numerical
33 IP address. A numerical IPv6 address must be written within [brackets].
34
35 To specify port number in this string, append :[port] to the end of the host
36 name. The proxy's port number may optionally be specified with the separate
37 option \fICURLOPT_PROXYPORT(3)\fP. If not specified, libcurl will default to
38 using port 1080 for proxies.
39
40 The proxy string may be prefixed with [scheme]:// to specify which kind of
41 proxy is used. Use socks4://, socks4a://, socks5:// or socks5h:// (the last
42 one to enable socks5 and asking the proxy to do the resolving, also known as
43 \fICURLPROXY_SOCKS5_HOSTNAME\fP type) to request the specific SOCKS version to
44 be used. No scheme specified or http://, will be treated as HTTP proxies.
45
46 Without a scheme prefix, \fICURLOPT_PROXYTYPE(3)\fP can be used to specify
47 which kind of proxy the string identifies.
48
49 When you tell the library to use a HTTP proxy, libcurl will transparently
50 convert operations to HTTP even if you specify an FTP URL etc. This may have
51 an impact on what other features of the library you can use, such as
52 \fICURLOPT_QUOTE(3)\fP and similar FTP specifics that don't work unless you
53 tunnel through the HTTP proxy. Such tunneling is activated with
54 \fICURLOPT_HTTPPROXYTUNNEL(3)\fP.
55
56 libcurl respects the environment variables \fBhttp_proxy\fP, \fBftp_proxy\fP,
57 \fBall_proxy\fP etc, if any of those are set. The \fICURLOPT_PROXY(3)\fP
58 option does however override any possibly set environment variables.
59
60 Setting the proxy string to "" (an empty string) will explicitly disable the
61 use of a proxy, even if there is an environment variable set for it.
62
63 A proxy host string can also include protocol scheme (http://) and embedded
64 user + password.
65 .SH DEFAULT
66 Default is NULL, meaning no proxy is used.
67
68 When you set a host name to use, do not assume that there's any particular
69 single port number used widely for proxies. Specify it!
70 .SH PROTOCOLS
71 All except file://. Note that some protocols don't do very well over proxy.
72 .SH EXAMPLE
73 TODO
74 .SH AVAILABILITY
75 Since 7.14.1 the proxy environment variable names can include the protocol
76 scheme.
77
78 Since 7.21.7 the proxy string supports the socks protocols as "schemes".
79
80 Since 7.50.2, unsupported schemes in proxy strings cause libcurl to return
81 error.
82 .SH RETURN VALUE
83 Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or
84 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
85 .SH "SEE ALSO"
86 .BR CURLOPT_PROXYPORT "(3), " CURLOPT_HTTPPROXYTUNNEL "(3), "
87 .BR CURLOPT_PROXYTYPE "(3)"