curl-library
Re: On resetting cookie "engine" and curl connections
Date: Tue, 11 Oct 2005 13:27:46 +0200 (CEST)
On Tue, 11 Oct 2005, Roberto Nibali wrote:
>  if (reset_cookie) {
>    curl_easy_setopt(curl, CURLOPT_COOKIELIST, "ALL");
>    curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
>  }
Yes, this seems like the correct approach to clear all existing cookies and 
make the cookie engine enabled.
>  if (reset_handle) {
>    curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
>  }
> }
>
> And reset_handle should actually simulate a browser that opens a new channel 
> or more.
>
> Reading the libcurl documentation this kind of stroke me as the most correct 
> way of doing it. However I still like to ask if my assumptions are correct. 
> Especially if the CURLOPT_FRESH_CONNECT really closes all "cached" open 
> connections?
No. There's actually no way to enforce a closure of all open connections 
without doing curl_easy_cleanup(). Not even curl_easy_reset() does that.
CURLOPT_FRESH_CONNECT simply makes the next request to use a new connection 
(and thus prevents it from re-using an existing one). It will not affect the 
existing ones (unless it needs to close a connection to make room for the new 
one in the connection cache).
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2005-10-11