SPUG: CGI::Cookies question

Colin Meyer cmeyer at zipcon.net
Thu Feb 17 15:54:24 CST 2000


At first glance, your code looks fine.  One possible gotcha that I've been 
tricked by happens when the clocks of the two systems (server and client) 
significantly differ.  Your cookie is set to expire in one hour.  The cookie's
expiration time is not actually communicated as "one hour from now", but rather
as a specific time, GMT.  That date could be miscalculated at either the 
client or the server end, causing the cookie to prematurely expire.

-C.


On Thu, Feb 17, 2000 at 10:05:10AM -0800, Peter Darley wrote:
> Friends,
> 	I guess I'll take advantage of this slow period on the list to ask my
> stupid question.  The problem I'm having is that I have a problem with IE
> accepting my cookies.  My code is thus:
> 
> ----------------------------------------------------------------
> use CGI qw/:standard/;
> use CGI::Cookie;
> 
> print SetStandardCookies($UserName, $Password);
> 
> s*b SetStandardCookies
> 	{
> 	my ($UserName, $Password) = @_;
> 
> 	my ($UserNameCookie, $PasswordCookie);
> 
> 	$UserNameCookie = new CGI::Cookie(-name    =>  'UserName',
>                      -value   =>  $UserName,
>                      -domain  =>  'cdarley.dyndns.org',
>                      -path    =>  '/games/',
>                      -expires =>  "+1h");
> 
> 	$PasswordCookie = new CGI::Cookie(-name    =>  'Password',
>                      -value   =>  $Password,
>                      -domain  =>  'cdarley.dyndns.org',
>                      -path    =>  '/games/',
>                      -expires =>  "+1h");
> 	return header(-cookie=>[$UserNameCookie, $PasswordCookie]);
> 	};
> ----------------------------------------------------------------
> 
> 	It sets the cookie on Netscape, and used to set the cookie on IE browsers
> when my application was being served from a Win98 machine, but now that I've
> ported it to Apache mod_perl under Linux, IE doesn't end up with any
> cookies.  Anybody have any experience with this kind of thig, or is there
> some obvouse error in my code?
> 
> 	Thanks for your help!
> 
> Peter Darley
> 
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>     POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
>  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
>  SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
>         Email to majordomo at pm.org: ACTION spug-list your_address
> 

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list