cURL / Mailing Lists / curl-library / Single Mail


Re: A HTTPPOST question

From: Daniel Stenberg <>
Date: Fri, 29 Aug 2008 20:18:34 +0200 (CEST)

On Fri, 29 Aug 2008, Serge Skorokhodov wrote:

> curl_formadd page says that form data can be cleaned safely with
> curl_formfree after curl_easy_perform call while curl_easy_setopt page
> insists that as soon as the list of form parts is set with CURLOPT_HTTPPOST,
> "The data in this list must remain intact until you close this curl handle
> again with curl_easy_cleanup(3)." This is far beyond the task lifetime and
> will preclude the use of curl handle shared among all tasks in a thread.
> So, my question is: what is the correct way to recover an easy curl handle
> after performing a rfc1867-style post in order to reuse it for different
> HTTP methods.

You can free the entire post with curl_formfree() after the
curl_easy_perform() call. But you need to make sure that you either set
another request method or set a new formpost in the handle before you call
curl_easy_perform() again on the same handle.

Does this sound clear enough?

Received on 2008-08-29