cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cookie Jar - Changing Cookies

From: Ralph Mitchell <rmitchell_at_eds.com>
Date: Thu, 07 Mar 2002 00:14:06 -0600

Is it just me, or can't this be done already ?

Consider a script that does this:

    1) fire up curl to grab a page, following redirects, saving cookies and the
html in files, etc.

    2) examine the html (eg for form extraction/submission)

    3) fire up curl again, feeding back the cookie jar (or the header file) to
get the next page

    4) repeat step 2 & 3 until bored and/or finished

Step 1.5 or step 2.5 could be "edit the cookie-jar/header-file" in some way.
This is a script, it can do anything the programmer's little heart desires,
right ? As long as you're not doing so much in between curl runs that the
cookies expire, anything's possible... And you could probably even edit the
expiry time... :)

It would even work with libcurl, using the callback trick as in the example
"getinmemory.c" to save the headers in memory, add/change/delete cookies, then
push them back out in the next curl call.

No, I'm not volunteering (not yet anyway), just trying to help the discussion
along :)

Just to play Devil's Advocate, why mess with the cookie jar anyway ? What are
the odds on the cookie sender recognising an altered cookie ?

Ralph

Daniel Stenberg wrote:

> On Wed, 6 Mar 2002, Paul Harrington wrote:
>
> > > Feel free to suggest a better way how this could be done in the future.
> > > I'm interested.
> >
> > It might be nice to have a mechanism to retreive,add,delete cookies from
> > the jar.
>
> Any more specific thoughts? Like how the functions would work? Interface-wise
> I mean.
>
> I don't mean to drag anything out of you that you don't know or want to, I'm
> just thinking that if you would present a more complete suggestion it is
> easier to discuss and it makes it easier for someone to jump up and shout
> "I'll do it" or if that doesn't happen, it gives us a better description to
> add to the TODO list.
>
> I mean, someone would need to do it anyway.
>
> --
> Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-07