curl-library
Re: A HTTPPOST question
Date: Sun, 31 Aug 2008 10:46:21 +0400
Hi,
On Fri, Aug 29, 2008 at 10:18 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> 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?
>
Thanks, it is. I've looked into the code briefly and it seems that
curl_easy_reset should be sufficient. Is it? Or is it better to set
GET method?
TIA
-- The fish that is singing in Ucayali river...Received on 2008-08-31