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 🫢


mwah πŸ’– this page is from libcurl and dated 2026-10-12 β€” go forth and authenticate those proxies, bestie. 🫢✨

πŸ“¦ where this page comes from