1CURLOPT_PRIVATE(3) libcurl CURLOPT_PRIVATE(3)
2
3
4
6 CURLOPT_PRIVATE - store a private pointer
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer);
12
14 Pass a void * as parameter, pointing to data that should be associated
15 with this curl handle. The pointer can subsequently be retrieved using
16 curl_easy_getinfo(3) with the CURLINFO_PRIVATE(3) option. libcurl it‐
17 self never does anything with this data.
18
20 NULL
21
23 All
24
26 CURL *curl = curl_easy_init();
27 struct private secrets;
28 if(curl) {
29 struct private *extracted;
30 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
31
32 /* store a pointer to our private struct */
33 curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
34
35 curl_easy_perform(curl);
36
37 /* we can extract the private pointer again too */
38 curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
39 }
40
42 Added in 7.10.3
43
45 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
46 if not.
47
49 CURLOPT_VERBOSE(3), CURLOPT_STDERR(3),
50
51
52
53ibcurl 8.2.1 April 26, 2023 CURLOPT_PRIVATE(3)