1CURLOPT_PRIVATE(3)         curl_easy_setopt options         CURLOPT_PRIVATE(3)
2
3
4

NAME

6       CURLOPT_PRIVATE - store a private pointer
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer);
12

DESCRIPTION

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 option. libcurl itself
17       never does anything with this data.
18

DEFAULT

20       NULL
21

PROTOCOLS

23       All
24

EXAMPLE

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

AVAILABILITY

42       Added in 7.10.3
43

RETURN VALUE

45       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
46       if not.
47

SEE ALSO

49       CURLOPT_VERBOSE(3), CURLOPT_STDERR(3),
50
51
52
53libcurl 7.82.0                 November 26, 2021            CURLOPT_PRIVATE(3)
Impressum