CURLINFO_USED_PROXY(3)

πŸ’… CURLINFO_USED_PROXY β€” did this transfer use a proxy? πŸ’…

okay bestie, this is the CURLINFO_USED_PROXY(3) page from the Library Functions Manual (libcurl edition 🌸). It’s giving β€œtiny but iconic proxy vibe check,” and honestly we’re obsessed.


✨ NAME ✨

CURLINFO_USED_PROXY β€” whether the transfer used a proxy 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <curl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a pointer to a long, no cap. After the previous transfer, that long gets set to zero if no proxy was used, or to a non-zero value if a proxy was used. That’s literally the whole vibe check πŸ’…

lowkey important: this tells you about the previous transfer, not some future one. periodt.

🌈 PROTOCOLS 🌈

This functionality affects all supported protocols. slay, universal queen behavior πŸ‘‘


πŸ”₯ EXAMPLE πŸ”₯

int main(int argc, char *argv[])
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
    curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
    curl_easy_setopt(curl, CURLOPT_NOPROXY, "example.com");

    result = curl_easy_perform(curl);

    if(!result) {
      /* extract the available proxy authentication types */
      long used;
      result = curl_easy_getinfo(curl, CURLINFO_USED_PROXY, &used);
      if(!result) {
        printf("The proxy was %sused\n", used ? "" : "NOT ");
      }
    }
    curl_easy_cleanup(curl);
  }
}

🧚 AVAILABILITY 🧚

Added in curl 8.7.0. so if ur on something older, it’s not giving what u need, bestie 😭


πŸ‘‘ RETURN VALUE πŸ‘‘

curl_easy_getinfo(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 🌸


πŸ’– source/version: libcurl Β· date: 2026-10-12 Β· mwah, bye bestie πŸ’–

πŸ“¦ where this page comes from