CURLINFO_PROXYAUTH_USED(3)

✨ CURLINFO_PROXYAUTH_USED(3) ✨

okay bestie so we're in the Library Functions Manual today and this one is genuinely a little gem πŸ’Ž it's CURLINFO_PROXYAUTH_USED, and yes it's giving very specific-girlie energy but that's literally the point πŸŽ€


🌸 NAME 🌸

CURLINFO_PROXYAUTH_USED β€” the HTTP proxy authentication method, aka "which auth flavor did the proxy actually make me use" πŸ•΅οΈβ€β™€οΈ


πŸ’… SYNOPSIS πŸ’…

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_USED, long *authp);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: you pass in a pointer to a long, and it gets filled with a bitmask telling you which authentication method was used in the previous request that went down over an HTTP proxy 🌈

the meaning of each possible bit? that's explained over in the CURLOPT_HTTPAUTH(3) option for curl_easy_setopt(3) β€” go read that one, iykyk πŸ“–

the returned value has zero or one bit set. zero or one. no in-between, no chaos, just math being math ✨


🧚 PROTOCOLS 🧚

this functionality affects http only β€” like, that's it, that's the whole list, don't come for her 🫢


πŸ”₯ EXAMPLE πŸ”₯

here's the whole thing, living its best life:

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, "http://proxy.example");
    curl_easy_setopt(curl, CURLOPT_PROXYAUTH,
                     CURLAUTH_BASIC | CURLAUTH_DIGEST);
    curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "shrek");
    curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "swamp");

    result = curl_easy_perform(curl);

    if(!result) {
      long auth;
      result = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_USED, &auth);
      if(!result) {
        if(!auth)
          printf("No auth used\n");
        else {
          if(auth == CURLAUTH_DIGEST)
            printf("Used Digest proxy authentication\n");
          else
            printf("Used Basic proxy authentication\n");
        }
      }
    }
    curl_easy_cleanup(curl);
  }
}

(and yes the credentials are literally shrek / swamp. no notes. iconic. πŸ‘‘)


⭐ AVAILABILITY ⭐

added in curl 8.12.0 β€” so if your curl is older than that, this info straight up does not exist for you, sorry bestie 😭


πŸ’œ RETURN VALUE πŸ’œ

curl_easy_getinfo(3) returns a CURLcode telling you success or error, that's the whole deal:

  • CURLE_OK (0) β€” everything was OK, slay πŸ’–
  • non-zero β€” an error occurred, go check libcurl-errors(3) for what it means πŸ™ˆ

πŸ“ SEE ALSO πŸ“


πŸ’€ reminder bestie: the value is a bitmask and it comes back with zero or one bit set β€” so don't go treating it like a free-for-all combo platter, okay? 🫢

k that's the whole page, mwah πŸ’‹ this came from libcurl dated 2026-10-12, and the page itself is CURLINFO_PROXYAUTH_USED(3) β€” go forth and auth your proxies responsibly, bestie πŸŒˆβœ¨πŸŽ€

πŸ“¦ where this page comes from