1CURLOPT_PRIVATE(3) curl_easy_setopt options 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
12 *pointer);
13
15 Pass a void * as parameter, pointing to data that should be associated
16 with this curl handle. The pointer can subsequently be retrieved using
17 curl_easy_getinfo(3) with the CURLINFO_PRIVATE option. libcurl itself
18 never does anything with this data.
19
21 NULL
22
24 All
25
27 CURL *curl = curl_easy_init();
28 struct private secrets;
29 if(curl) {
30 struct private *extracted;
31 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
32
33 /* store a pointer to our private struct */
34 curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
35
36 curl_easy_perform(curl);
37
38 /* we can extract the private pointer again too */
39 curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
40 }
41
43 Added in 7.10.3
44
46 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
47 if not.
48
50 CURLOPT_VERBOSE(3), CURLOPT_STDERR(3),
51
52
53
54libcurl 7.66.0 December 08, 2017 CURLOPT_PRIVATE(3)