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
12       tunnel);
13

DESCRIPTION

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

DEFAULT

37       0
38

PROTOCOLS

40       All network protocols
41

EXAMPLE

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

AVAILABILITY

52       Always
53

RETURN VALUE

55       Returns CURLE_OK
56

SEE ALSO

58       CURLOPT_PROXY(3), CURLOPT_PROXYTYPE(3), CURLOPT_PROXYPORT(3),
59
60
61
62libcurl 7.69.1                  April 17, 2018      CURLOPT_HTTPPROXYTUNNEL(3)
Impressum