Re: HTTP::Cookies::Netscape->save()

Gisle Aas (gisle@aas.no)
18 Feb 1999 13:54:44 +0100


"Jeremy D. Impson" <jdimpson@source.syr.edu> writes:

> Is discussing HTTP::* on-topic for this list? 

Not at all.

> The behaviours of HTTP::Cookies->save() and
> HTTP::Cookies::Netscape->save() are subtly different. 
> HTTP::Cookies->save() just prints to a file the output of
> HTTP::Cookies->as_string(), while HTTP::Cookies::Netscape->save() uses a
> special callback subroutine that prints out to the cookie file in
> Netscape's format.  However, there is one line that goes: 
> 
> 	return if $now > $expires;
> 
> resulting in the cookie not being written to the file.
> 
> I suppose this is makes some sense, but there is no such action taken in
> HTTP::Cookies->save() (at least, not that I saw, and certainly, for a
> cookie that HTTP::Cookies::Netscape->save() discards due to expiration,
> HTTP::Cookies->save() does not).
> 
> I would prefer that the callback did _not_ make this decision; the
> application should decide. However, I'd be just as happy with a
> "'ignore_expires' => 1" option to new() that causes the expire value to be
> ignored (but the expire value still inserted into the cookie file).

I consider this to be a bug in HTTP::Cookies->save().  I don't object
to having such an attribute, but I think I would prefer to call it
something like 'save_expired_cookies'.

> If the powers that be prefer one or the other, I'd be happy to code it up.

If you do, then please make 'save_expired_cookies' false by default
and fix HTTP::Cookies->save() so it don't accumulate cookies forever.

> I'd really like a way to write the cookie to Netscape's bookmark file.
> I'm writing a program to log in to Excite's email system.  It writes the
> cookies and then using Netscape I don't have to login by hand.  I've tried
> hardcoding the cookie into Netscape's cookie file, and it works (until
> removed by Netscape later).
> 
> (Now I just have to figure out how to get Netscape to reload the cookie
> file without having to restart it.)

Hack Mozilla source code maybe?

Regards,
Gisle