Set the cookie - works as expected:
Show the cookie with HTML - works as expected:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HEAD> <TITLE>Test</TITLE> <script type='text/Javascript'> document.cookie="ff=1;"; document.cookie="gg=;"; </script> </HEAD> <BODY> Cookie Set </BODY> </HTML>
Show the cookie with Perl - only works if cookie is empty<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Test </TITLE> </HEAD> <BODY> <script type='text/Javascript'> alert(document.cookie); </script> </BODY> </HTML>
I have tried this on a few servers.#!/usr/bin/perl use CGI::Cookie; %cookies = fetch CGI::Cookie(); $ctab .= "<table border=1>"; $ctab .= "<tr><td>Name</td><td>Value</td></tr>\n"; foreach $c (keys %cookies) { $v = $cookies{$c} -> value(); $ctab .= "<tr><td>$c</td><td>$v</td></tr>\n"; } $ctab .= "</table><BR><BR>"; print "Content-type: text/html\n\n"; print $ctab;
One: Free BSD / Apache 1.3.41 / Perl 5.6.1 shows both cookies with Perl and both with html.
Two: Red Hat ES 4 / Apache 2.0.52 / Perl 5.8.5 shows no cookies with Perl script and both with html.
Three: Red Hat 5.3 / Apache 2.2.3 / Perl 5.8.8 shows only empty cookies (gg) with Perl and both with html.
I have no idea why javascript shows the cookies are there and Perl does not recognize them. Any help would be greatly appreciated. Thank You.
In reply to Problems reading ALL cookies by Hammy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |