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