开发者

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:

  1. I run the "addCookie" script
  2. The script adds the cookie
  3. I run the "clearCookie" script
  4. The expiration dates of the cookies do not change
  5. I run the "addCookie" script again
  6. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜