cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: multiple session cookie handling

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 20 Jun 2001 10:58:26 +0200 (MET DST)

On Wed, 20 Jun 2001, Dustin Boswell wrote:

> I need to maintain/update cookies in the same way a browser
> would as I go through several web pages. The man page
> seems to suggest the
> "curl --cookie cookies.txt --dump-header cookies.txt"
> approach.

Yes.

> But how will that work seeing that the file is overwritten with each call
> to curl?

... the only cookies that would get stored in there would be the ones that is
sent back in the response.

> I suppose I could dump the header to a separate temporary file and append
> to the original. But then the cookie.txt (or whatever the main file is)
> will just grow bigger and bigger as time goes on, when it's possible that
> there's only a couple of cookies that are being updated on each web page
> access.

affirmative

> Has anyone out there handled this elegantly?

As I see it, the only really neat way to do it would involve a pretty
advanced cookie parser. In a similar style as the one libcurl features.

> I guess I'm looking for something that does the equivalent of "curl
> --cookie cookie.txt --dump-cookie cookie.txt --dump-header who_cares.txt"
> where the --dump-cookie option outputs the same cookies as the input file
> (possibly updated or removed if expired), plus any others that were
> encountered during the session. If I'm missing something on how the
> cookie thing works with curl, please let me know. Otherwise, what do
> people think about having a --dump-cookie option?

I think you're having a valid point here, we will need this option to get a
better picture of the *complete* and updated cookie situation.

I figure we could even output the cookies in netscape/mozilla format, as we
already understand reading that format.

I'm +1 on this suggestion. Don't assume that I can do it until at least
August though. Feel free to go ahead and provide us with patches!

-- 
     Daniel Stenberg -- curl dude -- http://curl.haxx.se/
Received on 2001-06-20