quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_PRIVATE.md (1429B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_PRIVATE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_PRIVATE (3)
      9   - CURLOPT_STDERR (3)
     10   - CURLOPT_VERBOSE (3)
     11 Protocol:
     12   - All
     13 Added-in: 7.10.3
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_PRIVATE - store a private pointer
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRIVATE, void *pointer);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a void * as parameter, pointing to data that should be associated with
     31 this curl handle. The pointer can subsequently be retrieved using
     32 curl_easy_getinfo(3) with the CURLINFO_PRIVATE(3) option. libcurl itself
     33 never does anything with this data.
     34 
     35 # DEFAULT
     36 
     37 NULL
     38 
     39 # %PROTOCOLS%
     40 
     41 # EXAMPLE
     42 
     43 ~~~c
     44 struct private {
     45   void *custom;
     46 };
     47 
     48 int main(void)
     49 {
     50   CURL *curl = curl_easy_init();
     51   struct private secrets;
     52   if(curl) {
     53     struct private *extracted;
     54     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     55 
     56     /* store a pointer to our private struct */
     57     curl_easy_setopt(curl, CURLOPT_PRIVATE, &secrets);
     58 
     59     curl_easy_perform(curl);
     60 
     61     /* we can extract the private pointer again too */
     62     curl_easy_getinfo(curl, CURLINFO_PRIVATE, &extracted);
     63   }
     64 }
     65 ~~~
     66 
     67 # %AVAILABILITY%
     68 
     69 # RETURN VALUE
     70 
     71 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     72 
     73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     74 libcurl-errors(3).