1curl_easy_duphandle(3)              libcurl             curl_easy_duphandle(3)
2
3
4

NAME

6       curl_easy_duphandle - Clone a libcurl session handle
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURL *curl_easy_duphandle(CURL *handle);
12

DESCRIPTION

14       This function will return a new curl handle, a duplicate, using all the
15       options previously set in the input curl handle. Both handles can  sub‐
16       sequently  be  used  independently  and  they  must  both be freed with
17       curl_easy_cleanup(3).
18
19       All strings that the input handle has been told to point to (as opposed
20       to  copy)  with  previous calls to curl_easy_setopt(3) using char * in‐
21       puts, will be pointed to by the new handle as well. You must  therefore
22       make  sure to keep the data around until both handles have been cleaned
23       up.
24
25       The new handle will not inherit any state information, no  connections,
26       no  SSL sessions and no cookies. It also will not inherit any share ob‐
27       ject states or options (it will be made as if CURLOPT_SHARE(3) was  set
28       to NULL).
29
30       In  multi-threaded programs, this function must be called in a synchro‐
31       nous way, the input handle may not be in use when cloned.
32

EXAMPLE

34       CURL *curl = curl_easy_init();
35       CURL *nother;
36       if(curl) {
37         CURLcode res;
38         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
39         nother = curl_easy_duphandle(curl);
40         res = curl_easy_perform(nother);
41         curl_easy_cleanup(nother);
42         curl_easy_cleanup(curl);
43       }
44

AVAILABILITY

46       Added in 7.9
47

RETURN VALUE

49       If this function returns NULL, something went wrong and no valid handle
50       was returned.
51

SEE ALSO

53       curl_easy_init(3),curl_easy_cleanup(3),curl_easy_reset(3),
54       curl_global_init(3)
55
56
57
58libcurl 8.2.1                   April 26, 2023          curl_easy_duphandle(3)
Impressum