Firefox not deleting expired Perl CGI::Cookie cookies
I am using Firefox 3.6.10 (OS X Intel), and the browser collects new cookies, instead of expiring ("deleting") the old cookies.
These cookies are created and added via Perl's CGI
and CGI::Cookie
modules.
I am creating and adding a cookie as follows:
my $myNewCookie = new CGI::Cookie(-name => "$myCookieName",
-value => { 'key1' => $value1, 'key2' => $value2 },
-expires => '+8h',
-secure => 1
);
prin开发者_JAVA技巧t redirect(-URL => "$hostURL$redirect",
-cookie => $myNewCookie);
Here is how I am trying to make them expire:
sub clearCookie {
my $myOldCookie = cookie(-name => "$myCookieName",
-value => '',
-expires => '-1d',
-secure => 1);
print header(-cookie=>$myOldCookie);
# ...
}
Here is what happens:
- I run the "addCookie" script
- The script adds the cookie
- I run the "clearCookie" script
- The expiration dates of the cookies do not change
- I run the "addCookie" script again
- The script adds a cookie with newer expiration dates
I can keep going and Firefox will just accumulate more cookies without expiring any of them.
My scripts work under current versions of Google Chrome and Apple Safari, but Firefox seems uncooperative.
Is there a setting I am missing, which will correctly tell Firefox to adjust the expiration date of my cookie?
Thanks for your advice.
It looks like this is a known and frustrating bug with Firefox.
精彩评论