cURL / Mailing Lists / curl-library / Single Mail

curl-library

On resetting cookie "engine" and curl connections

From: Roberto Nibali <ratz_at_drugphish.ch>
Date: Tue, 11 Oct 2005 12:02:39 +0200

Hello,

Part of my test tool is a little loop code which takes 1..n URLs and
does a fetch of those, then sleeps for a time and starts over again.
Optionally I have added a means to reset either the cookie engine and/or
to "reset" the curl_handle. What I would basically do is the following:

for (;;) {
  sleep for_some_time;
  if (reset_cookie) {
    curl_easy_setopt(curl, CURLOPT_COOKIELIST, "ALL");
    curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
  }
  if (reset_handle) {
    curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
  }
}

With this I would like to simulate kind of a browser handling.
reset_cookie means we click on the Clear button in the Privacy Tab of a
Firefox browser, for example. 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?

Thanks and regards,
Roberto Nibali, ratz

-- 
-------------------------------------------------------------
addr://Kasinostrasse 30, CH-5001 Aarau tel://++41 62 823 9355
http://www.terreactive.com             fax://++41 62 823 9356
-------------------------------------------------------------
terreActive AG                       Wir sichern Ihren Erfolg
-------------------------------------------------------------
Received on 2005-10-11