CURLOPT_PRIVATE − store a private pointer
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer);
Pass a void * as parameter, pointing to data that should be associated with this curl handle. The pointer can subsequently be retrieved using curl_easy_getinfo(3) with the CURLINFO_PRIVATE option. libcurl itself never does anything with this data.
CURL *curl =
struct private secrets;
struct private *extracted;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* store a
pointer to our private struct */
curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
/* we can
extract the private pointer again too */
curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
Added in 7.10.3
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.