1CURLOPT_HTTPPROXYTUNNEL(3) curl_easy_setopt options CURLOPT_HTTPPROXYTUNNEL(3)
2
3
4

NAME

6       CURLOPT_HTTPPROXYTUNNEL - tunnel through HTTP proxy
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPROXYTUNNEL, long tunnel);
12

DESCRIPTION

14       Set  the  tunnel  parameter to 1L to make libcurl tunnel all operations
15       through the HTTP proxy (set with CURLOPT_PROXY(3)). There is a big dif‐
16       ference between using a proxy and to tunnel through it.
17
18       Tunneling means that an HTTP CONNECT request is sent to the proxy, ask‐
19       ing it to connect to a remote host on a specific port number  and  then
20       the  traffic  is  just passed through the proxy. Proxies tend to white-
21       list specific port numbers it allows CONNECT requests to and often only
22       port 80 and 443 are allowed.
23
24       To suppress proxy CONNECT response headers from user callbacks use CUR‐
25       LOPT_SUPPRESS_CONNECT_HEADERS(3).
26
27       HTTP proxies can generally only speak HTTP (for obvious reasons), which
28       makes  libcurl  convert  non-HTTP  requests  to HTTP when using an HTTP
29       proxy without this tunnel option set. For example, asking  for  an  FTP
30       URL  and  specifying an HTTP proxy will make libcurl send an FTP URL in
31       an HTTP GET request to the proxy.  By  instead  tunneling  through  the
32       proxy,  you  avoid that conversion (that rarely works through the proxy
33       anyway).
34

DEFAULT

36       0
37

PROTOCOLS

39       All network protocols
40

EXAMPLE

42       CURL *curl = curl_easy_init();
43       if(curl) {
44         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
45         curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
46         curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
47         curl_easy_perform(curl);
48       }
49

AVAILABILITY

51       Always
52

RETURN VALUE

54       Returns CURLE_OK
55

SEE ALSO

57       CURLOPT_PROXY(3), CURLOPT_PROXYTYPE(3), CURLOPT_PROXYPORT(3),
58
59
60
61libcurl 7.82.0                 November 26, 2021    CURLOPT_HTTPPROXYTUNNEL(3)
Impressum