]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
first shaky and stumbling attempts at a *_duphandle() function
authorDaniel Stenberg <daniel@haxx.se>
Wed, 5 Sep 2001 07:24:01 +0000 (07:24 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 5 Sep 2001 07:24:01 +0000 (07:24 +0000)
lib/easy.c

index 38ae32082d4114b0ed8eb8197e78259660b05c8c..f9cb6d8607a503a6e02a717f63680acbe33549da 100644 (file)
@@ -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;
+}