Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
CURLOPT_PROXY(3) | Library Functions Manual | CURLOPT_PROXY(3) |
NAME
CURLOPT_PROXY - proxy to useSYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY, char *proxy);
DESCRIPTION
Set the proxy to use for transfers with this easy handle. The parameter should be a char * to a null-terminated string holding the hostname or dotted numerical IP address. A numerical IPv6 address must be written within [brackets].- http://
- HTTP Proxy. Default when no scheme or proxy type is specified.
- https://
-
HTTPS Proxy. (Added in 7.52.0 for OpenSSL and GnuTLS Since 7.87.0, it also works for BearSSL, mbedTLS, rustls, Schannel, Secure Transport and wolfSSL.)
- socks4://
- SOCKS4 Proxy.
- socks4a://
- SOCKS4a Proxy. Proxy resolves URL hostname.
- socks5://
- SOCKS5 Proxy.
- socks5h://
- SOCKS5 Proxy. Proxy resolves URL hostname.
Environment variables
libcurl respects the proxy environment variables named http_proxy, ftp_proxy, sftp_proxy etc. If set, libcurl uses the specified proxy for that URL scheme. For an "FTP://" URL, the ftp_proxy is considered. all_proxy is used if no protocol specific proxy was set.DEFAULT
NULLPROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
curl_easy_perform(curl);
}
}
HISTORY
Since 7.14.1 the proxy environment variable names can include the protocol scheme.AVAILABILITY
Added in curl 7.1RETURN VALUE
Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.SEE ALSO
CURLOPT_HTTPPROXYTUNNEL(3), CURLOPT_PRE_PROXY(3), CURLOPT_PROXYPORT(3), CURLOPT_PROXYTYPE(3)2024-12-21 | libcurl |