GNURLOPT_PRIVATE(3)
π
GNURLOPT_PRIVATE(3) β the curl_easy_setopt options girly β¨
okay so this page lives in the curl_easy_setopt options manual (gnurl edition, mwah) and it's literally about stashing your pointer somewhere safe so you can find it again later. no cap, that's the whole vibe. π
πΈ NAME πΈ
CURLOPT_PRIVATE β store a private pointer, bestie π«Ά
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer);
π DESCRIPTION π
So you pass a void * as the parameter, right? And that pointer points at literally whatever data you want associated with this curl handle. that's it. that's the whole thing. β¨
The pointer can subsequently be retrieved using curl_easy_getinfo(3) with the CURLINFO_PRIVATE option β so you can get it back out whenever you need it, iykyk. π¦
And likeβ¦ the important part? libcurl itself never does anything with this data. it's just holding your bag for you. it does not peek, it does not touch, it does not have opinions. π
π DEFAULT π
NULL β yeah, empty, nothing in there, starting fresh.
π PROTOCOLS π
All of them. every single one. periodt.
π EXAMPLE π
CURL *curl = curl_easy_init();
struct private secrets;
if(curl) {
struct private *extracted;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* store a pointer to our private struct */
curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
curl_easy_perform(curl);
/* we can extract the private pointer again too */
curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
}
like look at her go π storing the pointer, doing the request, then pulling the pointer back out. main character energy fr fr. π
β AVAILABILITY β
Added in 7.10.3 β vintage but iconic.
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that's the whole tea. π«
π₯ SEE ALSO π₯
ngl this one is so easy it's giving "why did I read the manual" β but now you know, and knowing is slaying. πβ¨
okay bye bestie, this page is from libcurl 7.37.0, dated 17 Jun 2014 β and yes, GNURLOPT_PRIVATE(3) is the header, love her, mwah ππΈ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms