CURLOPT_PRE_PROXY.3 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, 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.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 \- pre-proxy host to use
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRE_PROXY, char *preproxy);
  30. .fi
  31. .SH DESCRIPTION
  32. Set the \fIpreproxy\fP to use for the upcoming request. The parameter
  33. should be a char * to a null-terminated string holding the host name or dotted
  34. numerical IP address. A numerical IPv6 address must be written within
  35. [brackets].
  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. A pre proxy is a SOCKS proxy that curl connects to before it connects to the
  41. HTTP(S) proxy specified in the \fICURLOPT_PROXY\fP option. The pre proxy can
  42. only be a SOCKS proxy.
  43. The pre proxy string should be prefixed with [scheme]:// to specify which kind
  44. of socks is used. Use socks4://, socks4a://, socks5:// or socks5h:// (the last
  45. one to enable socks5 and asking the proxy to do the resolving, also known as
  46. \fICURLPROXY_SOCKS5_HOSTNAME\fP type) to request the specific SOCKS version to
  47. be used. Otherwise SOCKS4 is used as default.
  48. Setting the pre proxy string to "" (an empty string) will explicitly disable
  49. the use of a pre proxy.
  50. The application does not have to keep the string around after setting this
  51. option.
  52. .SH DEFAULT
  53. Default is NULL, meaning no pre proxy is used.
  54. When you set a host name to use, do not assume that there's any particular
  55. single port number used widely for proxies. Specify it!
  56. .SH PROTOCOLS
  57. All except file://. Note that some protocols do not work well over proxy.
  58. .SH EXAMPLE
  59. .nf
  60. CURL *curl = curl_easy_init();
  61. if(curl) {
  62. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
  63. curl_easy_setopt(curl, CURLOPT_PREPROXY, "socks4://socks-proxy:1080");
  64. curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
  65. curl_easy_perform(curl);
  66. }
  67. .fi
  68. .SH AVAILABILITY
  69. Added in 7.52.0
  70. .SH RETURN VALUE
  71. Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or
  72. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  73. .SH "SEE ALSO"
  74. .BR CURLOPT_PROXY "(3), " CURLOPT_HTTPPROXYTUNNEL "(3), "