CURLOPT_PROXYTYPE(3)

πŸ’… CURLOPT_PROXYTYPE(3) β€” like, the proxy protocol type, bestie ✨

so this is a page from the Library Functions Manual (libcurl, obvi πŸŽ€) and it's all about telling curl what kind of proxy it's talking to. let's get into it 🫢


✨ NAME ✨

CURLOPT_PROXYTYPE β€” the proxy protocol type, periodt πŸ’…


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYTYPE, long type);

that's the whole vibe check right there πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

okay so you literally just pass one of the values below and that sets the type of the proxy. that's it. that's the whole thing ✨

  • CURLPROXY_HTTP β€” HTTP Proxy. and yeah, it's the default πŸ’…
  • CURLPROXY_HTTPS β€” HTTPS Proxy using HTTP/1. (added in 7.52.0 for OpenSSL and GnuTLS. and since 7.87.0, it also works for mbedTLS, Rustls, Schannel and wolfSSL β€” glow up fr 🌈)
  • CURLPROXY_HTTPS2 β€” HTTPS Proxy AND it attempts to speak HTTP/2 over it. (added in 8.1.0, iconic behavior πŸ”₯)
  • CURLPROXY_HTTP_1_0 β€” HTTP 1.0 Proxy. this one's similar to CURLPROXY_HTTP except it uses HTTP/1.0 for any CONNECT tunneling. important: it does not change the HTTP version of the actual HTTP requests β€” that's controlled by CURLOPT_HTTP_VERSION(3) 🫢
  • CURLPROXY_SOCKS4 β€” SOCKS4 Proxy.
  • CURLPROXY_SOCKS4A β€” SOCKS4a Proxy. the proxy resolves the URL hostname 🧚
  • CURLPROXY_SOCKS5 β€” SOCKS5 Proxy.
  • CURLPROXY_SOCKS5_HOSTNAME β€” SOCKS5 Proxy. again, the proxy resolves the URL hostname 🧚
lowkey often it is way more convenient to specify the proxy type with the scheme part of the CURLOPT_PROXY(3) string. iykyk πŸ’œ

πŸŽ€ DEFAULT πŸŽ€

CURLPROXY_HTTP

the classic. the main character. the default ⭐


πŸ¦‹ PROTOCOLS πŸ¦‹

this functionality affects all supported protocols β€” yes, all of them, no cap 🌈


🌸 EXAMPLE 🌸

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    curl_easy_setopt(curl, CURLOPT_PROXY, "local.example.com:1080");
    /* set the proxy type */
    curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

look at that. URL set, proxy set, type set, perform, cleanup. clean. ate. no crumbs πŸ’…


πŸ’€ HISTORY πŸ’€

the CURLPROXY_* enums became long types in 8.16.0. before that version, a long cast was necessary when passed to curl_easy_setopt(3) β€” so like, don't get caught slipping on old versions πŸ™ˆ


πŸ’œ AVAILABILITY πŸ’œ

added in curl 7.10 ⭐


✨ RETURN VALUE ✨

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK πŸŽ‰ β€” non-zero means an error occurred, see libcurl-errors(3) for the full tea 😭


🫢 SEE ALSO 🫢


that's the whole page bestie, go configure some proxies responsibly πŸ’–

libcurl Β· 2026-10-12 Β· mwah, luv u, bye πŸ‘‹πŸ’…πŸŽ€

πŸ“¦ where this page comes from