CC: | webmaster [...] cbkihong.com |
Subject: | CGI/Util.pm |
Date: | Sun, 17 Sep 2006 14:46:05 +0800 |
To: | bug-CGI.pm [...] rt.cpan.org |
From: | Chan Bernard Ki Hong <webmaster [...] cbkihong.com> |
CGI.pm (and thus CGI::Cookie) does not seem to handle decimal relative time
for "-expires" properly, but the code in CGI/Util.pm makes me think the
original intent was to support it.
CGI/Util.pm - version 1.5.
CGI.pm - version 3.15.
Perl: This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
uname: Linux cbkihong.homelinux.com 2.6.14.5 #4 PREEMPT Tue May 30 20:35:53
HKT 2006 i686 GNU/Linux
#!/usr/bin/perl -w
use CGI;
my $cgi = new CGI;
print $cgi->header(
-type => 'text/html',
-cookie => [
$cgi->cookie(
-name => 'one',
-value => 'one',
-expires => '+1h',
),
$cgi->cookie(
-name => 'two',
-value => 'two',
-expires => '+2.5h', # BUG
),
],
);
OUTPUT:
Set-Cookie: one=one; path=/; expires=Sun, 17-Sep-2006 07:45:18 GMT
Set-Cookie: two=two; path=/; expires=Sun, 17-Sep-2006 06:45:20 GMT
The second cookie is created with an earlier expiration time than the first,
which is obviously wrong. The attached diff seems to fix it.
Thank you.
Regards,
Bernard Chan.
Message body is not shown because sender requested not to inline it.