cURL / Mailing Lists / curl-library / Single Mail

curl-library

how to clone curl_formadd ?

From: Sriram Natarajan <sriram.natarajan_at_gmail.com>
Date: Tue, 14 Jul 2009 12:56:01 -0700

Hi
 I need to clone curl_formadd so that i can continue to clean
curl_formfree on the previous handle . Any help on how do I do this will
be much appreciated.

This is what I am trying to do

a) I would like to post some data to the web server. So, I used some
thing like

  /* Fill in the file upload field
*/

  formrc = curl_formadd(&formpost, &lastptr, ... );
    
   /* First set the URL that is about to receive our POST. */
  curl_easy_setopt(curl, CURLOPT_URL, URL);

  /* Now specify we want to POST data */
 curl_easy_setopt(curl, CURLOPT_POST, 1L);

  /* send a multi-part formpost */
  curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);

  curl2 = curl_easy_duphandle(curl);
  /*way to clone curl_formadd */

/* cleanup of previous handle and form*/
  curl_easy_cleanup(curl);
  curl_form_free(formpost); /* clean the previous formadd */

  es = curl_easy_perform(curl2);
 
now, as you know , if I call curl_form_free before
curl_easy_perform(curl2), i get a segv. hence, my request to clone
curl_formfree.

- sriram
Received on 2009-07-14