curl-library
RE: Time for next round!
Date: Fri, 19 Aug 2005 15:03:44 -0500
Something I wasn't aware of until our recent discussion is that
if I set CURLOPT_COOKIEFILE more than once, I assumed that the
cookie list would be replaced, rather than appended.
For instance, if I have a file "cookies.one" that contains the line:
Set-Cookie: SECRET=ForYourEyesOnly; expires=Thu, 01-Jun-2006 19:00:00
GMT; path=/;
And a file named "cookies.two" that contains:
Set-Cookie: PUBLIC=InTheTabloids; expires=Thu, 01-Jun-2006 19:00:00 GMT; path=/;
It is not-so-obvious to me that the code below will send the _first_ cookie
to the _second_ server:
curl_easy_setopt(c, CURLOPT_COOKIEFILE, "cookies.one");
curl_easy_setopt(c, CURLOPT_URL, "http://www.yahoo.com/");
curl_easy_perform(c);
curl_easy_setopt(c, CURLOPT_COOKIEFILE, "cookies.two");
curl_easy_setopt(c, CURLOPT_URL, "http://www.google.com/");
curl_easy_perform(c);
Maybe the docs could mention something like:
"If this option is used more than once, the cookies from subsequent
files will be appended to the original list."
Regards,
- Jeff
Received on 2005-08-19