From 610ec27d933843a0d5f954383f599aa33002e0e5 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 5 Sep 2001 07:24:01 +0000 Subject: first shaky and stumbling attempts at a *_duphandle() function --- lib/easy.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/easy.c b/lib/easy.c index 38ae32082..f9cb6d860 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -250,3 +250,30 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...) return Curl_getinfo(data, info, paramp); } + +CURL *curl_easy_duphandle(CURL *incurl) +{ + struct SessionHandle *data=(struct SessionHandle *)incurl; + + struct SessionHandle *outcurl = malloc(sizeof(struct SessionHandle)); + + if(NULL == outcurl) + return NULL; /* failure */ + + /* start with clearing the entire new struct */ + memset(outcurl, 0, sizeof(struct SessionHandle)); + + /* copy all userdefined values */ + outcurl->set = data->set; + + /* duplicate all values in 'change' */ + outcurl->change.url = strdup(data->change.url); + outcurl->change.proxy = strdup(data->change.proxy); + outcurl->change.referer = strdup(data->change.referer); + /* set all the alloc-bits */ + outcurl->change.url_alloc = + outcurl->change.proxy_alloc = + outcurl->change.referer_alloc = TRUE; + + return outcurl; +} -- cgit v1.2.3