[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reset multiple cookies


Very strange then... My best guess is the browser will only accept one cookie with a given name in a given set of headers - check the response headers to see that they're all there, then you know it's the browser. I found the Web Developers Toolbar for Firefox very useful when doing my cookie code - you can view, manually add, clear session cookies, clear domain cookies, view which cookies will be sent to the server, view response headers etc.

Marc Lambrichs wrote:
That's exactly what I'm trying to do now. But, like I said, only the last one is changed/set.

Marc

John ORourke wrote:

Marc Lambrichs wrote:

I'm trying to reset multiple cookies. However, only the last one of the @cookies array is reset. How come?

       foreach ( @domains ){
                                                   ( domain => $_ ),
       foreach my $cookie ( @cookies ){
$r->err_headers_out->add( 'Set-Cookie' => $cookie->as_string );
       }


This would only work if all the domains have an ending containing 2 dots matching the host setting it - eg. www.yoursite.com can set cookies for something.yoursite.com and another.yoursite.com, but not for www.microsoft.com. Imagine if your favourite warez site set a cookie with domain microsoft.com...

Of course, this rule was invented by short-sighted inhabitants of .com/net/org, so when .co.uk came along it became a bit worthless but nobody's ever decided to fix it.

http://blog.javido.net/index.php?tag=cookies

cheers
John





Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.