in reply to CGI::Cookie problem in FF and IE
The call returns (in opera) with the following values set:#!/usr/bin/env perl use strict; use warnings; #BEGIN { # $| = 1; # open (STDERR, ">&STDOUT"); # print qq~Content-type: text/html\n\n~; #} use CGI; use CGI::Cookie; use CGI::Carp qw(fatalsToBrowser); use DBI; use DBD::Pg; use LWP 5.69; use HTTP::Request::Common qw( POST ); use HTML::Entities; my $buffer = ""; my $name = ""; my $value = ""; my @pair; my $key; my $cookie; my $test; my $session; my $query; #$main::cookies = $main::session->cookie(-name => 'NCWiFiTest', # Set username $main::session = new CGI; $main::cookie = $main::session->cookie(-name => 'User-Name', -value => 'todd', -domain => 'localhost', -path => '/', -expires => '+1d' ); $main::cookie->bake; print "<hr>\n"; $main::query = new CGI; $main::test = ""; $main::test = $main::query->cookie(-name => 'User-Name'); print "User Name --> $main::test\n"; print "<br>"; print "<hr>\n"; foreach $main::key (keys %ENV) { print "$main::key --> $ENV{$main::key}<br>"; } print "End of environment<P>"; # Get the input read(STDIN, $main::buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @main::pairs = split(/&/, $main::buffer); foreach $main::pair (@main::pairs) { ($main::name, $main::value) = split(/=/, $main::pair); # Un-Webify plus signs and %-encoding $main::value =~ tr/+/ /; $main::value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). $main::value =~ s/~!/ ~!/g; # Uncomment for debugging purposes print "Setting $main::name to $main::value<P>"; } exit;
Live HTTP Headers (in Firefox) shows:
Set-Cookie: User-Name=todd; domain=localhost; path=/; expires=Wed, 08-Aug-2007 02:49:15 GMT
Update:
I tried using CGI::Simple::Cookie. This works, the only change noted is that the header includes "Cookie: " instead of "Set-Cookie: ". I will investigate this further.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI::Cookie problem in FF and IE
by Errto (Vicar) on Aug 07, 2007 at 03:16 UTC | |
by proceng (Scribe) on Aug 07, 2007 at 14:10 UTC | |
|
Re^2: CGI::Cookie problem in FF and IE
by Anonymous Monk on Aug 07, 2007 at 10:28 UTC |