cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_COOKIELIST side effects

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Wed, 17 Aug 2005 18:06:48 -0500

> > I've been trying to get a feel for the new cookie interface, and I noticed
> > the code below will clobber an existing cookie file.

> Fix committed, please test this and check that it does what you expect it to!

Yes, that does the trick, although I'm not familiar enough with the
COOKIELIST stuff to really know what the "correct" behavior should
be, other than the principle of least surprise.

FWIW, I am trying to update the Delphi/Pascal bindings, and I thought
possibly to provide some sort of object-oriented methods to make the
cookie handling a bit more transparent, but keeping the internal and
external representation of cookielist, cookiefile, and cookiejar all
synchronized is turning out to be a bit more work than I expected.

For one thing, I had hoped that loading a CURLOPT_COOKIEFILE would
automatically update the CURLINFO_COOKIELIST, but it looks like that
doesn't happen until after curl_easy_perform. The simple solution on
the user's side is to read the cookie file in manually line-by-line,
and call CURLOPT_COOKIELIST for each line.

That seems to work, it updates CURLINFO_COOKIELIST, but it brings up the
question, is it safe to call curl_easy_getinfo before curl_easy_perform?
The man page says that's a no-no, but it looks like there are already a
couple of exceptions for CURLINFO_SSLENGINES and CURLINFO_PRIVATE.

Another thing I haven't figured out is how to delete a single cookie from
the list. There was some mention in the preliminary discussions on
http://curl.haxx.se/mail/lib-2004-12/0195.html :

  "To remove a cookie that libcurl already knows about, you simply set
  it with no contents, or you set it with an expired time."

... but currently that doesn't seem to have any immediate effect.

Of course, none of these issues is really essential to any ongoing
project of mine, it's just an idea rolling around in my head on how
to abstract the cookie handling in a way that looks more "delphi-ish"

At any rate, thanks again for your quick response and fix for the
original issue!

 - Jeff
Received on 2005-08-18