cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Maintaining the socket for the HTTP operation

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 21 Jan 2011 15:00:35 -0800

On Fri, Jan 21, 2011 at 02:15:03PM +0530, darshan.mody_at_wipro.com wrote:
> We have a application that needs to maintain the socket and perform HTTP
> operations. However using curl_easy_cleanup leads to closing the socket. We
> also tried to use curl_easy_reset however it is not working with the latest
> version of libcurl and the application is not able to add the content in the
> message.
>
> I used curl_easy_reset once the operation is completed. It worked for me till
> 7.19.2 however it is not working for me now. Somebody did suggested that not to
> do anything on the CURL handle, I tried by not resetting the handle and it
> works however shouldn?t we reset the handle. Kindly guide me for the same.

Resetting the handle should put it into effectively the same state that it was
after the initial curl_easy_init(). That means that the code needs to set
every option necessary to get it ready for a curl_easy_perform. If some or most
options are the same from one use of the handle to the next, you can avoid
calling curl_easy_reset() and just set the options that are different from the
last operation (e.g. CURLOPT_URL).

If you're finding that the behaviour after a curl_easy_reset is different from
the behaviour after a curl_easy_init, then it's likely to be a bug in libcurl.
If you can post a snippet of code that shows this problem, we can look into it.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-22