GNURLINFO_PRIVATE(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

okay bestie, welcome to the <pink>GNURLINFO_PRIVATE(3)</pink> page β€” yep, the <cyan>curl_easy_getinfo</cyan> options crew. today we're getting the private pointer, and honestly it's giving tiny-but-mighty icon energy. ✨

πŸ’– NAME πŸ’–

CURLINFO_PRIVATE β€” get the private pointer. literally just that, bestie. 🫢

✨ SYNOPSIS ✨

here's the exact signature, no cap:

#include <gnurl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

you pass in a pointer to a char pointer so it can receive the pointer to the private data that's associated with the curl handle β€” the one you set with CURLOPT_PRIVATE(3). okay and important: for internal reasons, the value comes back as a char pointer, even though it's effectively a 'void *'. that's the vibe, that's the fact. πŸ’…

🌈 PROTOCOLS 🌈

All β€” every single one, periodt. ⭐

🧚 EXAMPLE 🧚

here's the whole lil demo, copy it, love it:

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

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

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

  curl_easy_cleanup(curl);
}

πŸ‘‘ AVAILABILITY πŸ‘‘

this cutie was added in 7.10.3 ✨

πŸŽ€ RETURN VALUE πŸŽ€

if the option is supported, you get CURLE_OK; if not, you get CURLE_UNKNOWN_OPTION. no in-between, bestie. πŸ’–

πŸ“ SEE ALSO πŸ“


xoxo, bestie β€” this page came from libcurl 7.44.0, dated 1 Sep 2015. πŸ’…πŸ«Ά

πŸ“¦ where this page comes from