CURLINFO_PRIVATE(3)

πŸ’… CURLINFO_PRIVATE πŸ’…

okay bestie, welcome to the CURLINFO_PRIVATE(3) page β€” this is a Library Functions Manual entry, and honestly it's giving tiny-but-mighty. it's the whole "i have a secret little pointer and i want it back" situation. let's go 🫢


✨ NAME ✨

CURLINFO_PRIVATE β€” the private pointer, aka your lil' secret stash πŸ”

🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIVATE, char **private);

πŸ’– DESCRIPTION πŸ’–

so here's the vibe: you pass in a pointer to a char pointer, and it gets filled up with the pointer to the private data that's chillin' on the curl handle. that private data is the stuff you set earlier with CURLOPT_PRIVATE(3). cute, right? πŸŽ€

⚠️ heads up bestie β€” for internal reasons, the value comes back as a char pointer, even though it's effectively a 'void *'. so like, don't come for it, that's just how it is 😭

πŸ¦‹ PROTOCOLS πŸ¦‹

this functionality affects all supported protocols. all of them. every single one. no cap πŸ‘‘

🌈 EXAMPLE 🌈

okay this is the part where it gets iconic, here's the whole thing verbatim:

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    void *pointer = (void *)0x2345454;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");

    /* set the private pointer */
    curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
    result = curl_easy_perform(curl);

    /* extract the private pointer again */
    result = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);

    if(result)
      printf("error: %s\n", curl_easy_strerror(result));

    curl_easy_cleanup(curl);
  }
}

like β€” set it, perform it, get it back, check for errors, clean up. the full little routine, and she ate πŸ”₯

⭐ AVAILABILITY ⭐

added in curl 7.10.3 β€” a certified vintage, honestly πŸ’œ

🧚 RETURN VALUE 🧚

curl_easy_getinfo(3) returns a CURLcode that says whether it worked or flopped. specifically:

  • CURLE_OK (0) β€” everything was OK, we slayed ✨
  • non-zero β€” an error occurred 😭 see libcurl-errors(3) for the details

πŸŽ€ SEE ALSO πŸŽ€


okay that's the whole page, mwah πŸ’‹ β€” this was libcurl, dated 2026-10-12, filed under CURLINFO_PRIVATE(3). go forth and stash your pointers responsibly πŸŒΈπŸ¦‹πŸ’…

πŸ“¦ where this page comes from