The following reply was made to PR mod_jserv/3795; it has been noted by GNATS.
From: Cris Perdue <[EMAIL PROTECTED]>
To: Marc Slemko <[EMAIL PROTECTED]>
Cc: Apache bugs database <[EMAIL PROTECTED]>
Subject: Re: mod_jserv/3795: Problems with cookie expiration date formats
Date: Sat, 30 Jan 1999 16:51:02 -0800
Hi Marc,
Point taken on the importance of real compatibility compared with
specs. Top priority is that the code should work properly with other
software, in other words with browsers.
I did get motivated to look at what Perl does, since Perl is heavily
used for CGI scripting and its source code is available. Here is the
subroutine from the current CGI.pm (2.46) for Perl 5.
# This internal routine creates date strings suitable for use in
# cookies and HTTP headers. (They differ, unfortunately.)
# Thanks to Fisher Mark for this.
'expires' => <<'END_OF_FUNC',
sub expires {
my($time,$format) = @_;
$format ||= 'http';
my(@MON)=qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
my(@WDAY) = qw/Sun Mon Tue Wed Thu Fri Sat/;
# pass through preformatted dates for the sake of expire_calc()
$time = expire_calc($time);
return $time unless $time =~ /^\d+$/;
# make HTTP/cookie date string from GMT'ed time
# (cookies use '-' as date separator, HTTP uses ' ')
my($sc) = ' ';
$sc = '-' if $format eq "cookie";
my($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime($time);
$year += 1900;
return sprintf("%s, %02d$sc%s$sc%04d %02d:%02d:%02d GMT",
$WDAY[$wday],$mday,$MON[$mon],$year,$hour,$min,$sec);
}
Looks like the 4-digit year is OK.
Regards,
--
Cris Perdue
Impact Online, Inc.
http://www.volunteermatch.org