CURLOPT_HTTPPROXYTUNNEL.3 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .\" generated by cd2nroff 0.1 from CURLOPT_HTTPPROXYTUNNEL.md
  2. .TH CURLOPT_HTTPPROXYTUNNEL 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_HTTPPROXYTUNNEL \- tunnel through HTTP proxy
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPROXYTUNNEL, long tunnel);
  9. .fi
  10. .SH DESCRIPTION
  11. Set the \fBtunnel\fP parameter to 1L to make libcurl tunnel all operations
  12. through the HTTP proxy (set with \fICURLOPT_PROXY(3)\fP). There is a big
  13. difference between using a proxy and to tunnel through it.
  14. Tunneling means that an HTTP CONNECT request is sent to the proxy, asking it
  15. to connect to a remote host on a specific port number and then the traffic is
  16. just passed through the proxy. Proxies tend to white\-list specific port numbers
  17. it allows CONNECT requests to and often only port 80 and 443 are allowed.
  18. To suppress proxy CONNECT response headers from user callbacks use
  19. \fICURLOPT_SUPPRESS_CONNECT_HEADERS(3)\fP.
  20. HTTP proxies can generally only speak HTTP (for obvious reasons), which makes
  21. libcurl convert non\-HTTP requests to HTTP when using an HTTP proxy without
  22. this tunnel option set. For example, asking for an FTP URL and specifying an
  23. HTTP proxy makes libcurl send an FTP URL in an HTTP GET request to the
  24. proxy. By instead tunneling through the proxy, you avoid that conversion (that
  25. rarely works through the proxy anyway).
  26. .SH DEFAULT
  27. 0
  28. .SH PROTOCOLS
  29. This functionality affects all supported protocols
  30. .SH EXAMPLE
  31. .nf
  32. int main(void)
  33. {
  34. CURL *curl = curl_easy_init();
  35. if(curl) {
  36. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
  37. curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
  38. curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
  39. curl_easy_perform(curl);
  40. }
  41. }
  42. .fi
  43. .SH AVAILABILITY
  44. Added in curl 7.3
  45. .SH RETURN VALUE
  46. Returns CURLE_OK
  47. .SH SEE ALSO
  48. .BR CURLOPT_PROXY (3),
  49. .BR CURLOPT_PROXYPORT (3),
  50. .BR CURLOPT_PROXYTYPE (3)