CURLOPT_PROXYAUTH(3)
CURLOPT_PROXYAUTH(3) π β¨
okay bestie, welcome to a Library Functions Manual moment β this page is all about CURLOPT_PROXYAUTH, and it's gonna make proxy auth make sense, no cap. π«Ά
πΈ NAME πΈ
CURLOPT_PROXYAUTH β HTTP proxy authentication methods. π
β¨ SYNOPSIS β¨
the signature is literally right here:
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask);
π DESCRIPTION π
so here's the vibe: you pass a long as the parameter, and that long is a bitmask. It tells libcurl which HTTP authentication method(s) you want it to use for your proxy authentication. π¦
if more than one bit is set, libcurl first queries the site to see what authentication methods it supports, then it picks the best one you allow it to use. For some methods, this induces an extra network round-trip β yes, an actual extra trip, not a drill. π
the actual name and password? set those with the CURLOPT_PROXYUSERPWD(3) option. periodt. π
the bitmask can be constructed by the bits listed and described in the CURLOPT_HTTPAUTH(3) man page. go read that one too, iykyk. π§
π DEFAULT π
CURLAUTH_BASIC β that's the default, bestie. π
π PROTOCOLS π
This functionality affects all supported protocols. all of them. no cap. β
π EXAMPLE π
here's the example, copied exactly so you can steal it responsibly: π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* use this proxy */
curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
/* allow whatever auth the proxy speaks */
curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
/* set the proxy credentials */
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π HISTORY π
history check: CURLAUTH_* macros became long types in 7.26.0. prior to this version, a long cast was necessary when passed to curl_easy_setopt(3). she's got lore. π
π₯ AVAILABILITY π₯
Added in curl 7.10.7. old enough to be iconic. π
π 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). π
π«Ά SEE ALSO π«Ά
CURLOPT_HTTPAUTH(3)CURLOPT_PROXY(3)CURLOPT_PROXYPORT(3)CURLOPT_PROXYTYPE(3)CURLOPT_PROXYUSERPWD(3)
mwah π this page is from libcurl and dated 2026-10-12 β go forth and authenticate those proxies, bestie. π«Άβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms