quickjs-tart

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

curl_easy_duphandle.md (1874B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: curl_easy_duphandle
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_easy_cleanup (3)
      9   - curl_easy_init (3)
     10   - curl_easy_reset (3)
     11   - curl_global_init (3)
     12 Protocol:
     13   - All
     14 Added-in: 7.9
     15 ---
     16 
     17 # NAME
     18 
     19 curl_easy_duphandle - clone an easy handle
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURL *curl_easy_duphandle(CURL *handle);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 This function returns a new curl handle, a duplicate, using all the options
     32 previously set in the input curl *handle*. Both handles can subsequently be
     33 used independently and they must both be freed with curl_easy_cleanup(3).
     34 
     35 Any options that the input handle has been told to point to (as opposed to
     36 copy) with previous calls to curl_easy_setopt(3), are pointed to by the new
     37 handle as well. You must therefore make sure to keep the data around until
     38 both handles have been cleaned up.
     39 
     40 The new handle does **not** inherit any state information, no connections, no
     41 SSL sessions and no cookies. It also does not inherit any share object states
     42 or options (created as if CURLOPT_SHARE(3) was set to NULL).
     43 
     44 If the source handle has HSTS or alt-svc enabled, the duplicate gets data read
     45 data from the main filename to populate the cache.
     46 
     47 In multi-threaded programs, this function must be called in a synchronous way,
     48 the input handle may not be in use when cloned.
     49 
     50 # %PROTOCOLS%
     51 
     52 # EXAMPLE
     53 
     54 ~~~c
     55 int main(void)
     56 {
     57   CURL *curl = curl_easy_init();
     58   if(curl) {
     59     CURLcode res;
     60     CURL *nother;
     61     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     62     nother = curl_easy_duphandle(curl);
     63     res = curl_easy_perform(nother);
     64     curl_easy_cleanup(nother);
     65     curl_easy_cleanup(curl);
     66   }
     67 }
     68 ~~~
     69 
     70 # %AVAILABILITY%
     71 
     72 # RETURN VALUE
     73 
     74 If this function returns NULL, something went wrong and no valid handle was
     75 returned.