diff -Naur tds-1.00-pl3/comment.cgi tds-1.00-pl3_konishi/comment.cgi --- tds-1.00-pl3/comment.cgi Fri Dec 10 18:10:35 1999 +++ tds-1.00-pl3_konishi/comment.cgi Tue Mar 14 15:29:00 2000 @@ -8,7 +8,7 @@ use JConv; use CGI::QueryString; -use CGI::Cookie; +use CGI::Cookie_tds; use CGI::Tools; use DateTime::Time; diff -Naur tds-1.00-pl3/comment_name.cgi tds-1.00-pl3_konishi/comment_name.cgi --- tds-1.00-pl3/comment_name.cgi Tue Aug 10 15:40:51 1999 +++ tds-1.00-pl3_konishi/comment_name.cgi Tue Mar 14 15:29:37 2000 @@ -3,7 +3,7 @@ use strict; use lib qw(lib); -use CGI::Cookie; +use CGI::Cookie_tds; print "content-type: text/html\n\n"; print GetCookie("name"); diff -Naur tds-1.00-pl3/contrib/tds_server.pl tds-1.00-pl3_konishi/contrib/tds_server.pl --- tds-1.00-pl3/contrib/tds_server.pl Tue Jul 6 22:41:45 1999 +++ tds-1.00-pl3_konishi/contrib/tds_server.pl Tue Mar 14 15:30:57 2000 @@ -76,7 +76,7 @@ sub execute() { &CGI::QueryString::Reload(); - &CGI::Cookie::Reload(); + &CGI::Cookie_tds::Reload(); my $status = new TDS::Status; $status->debug(1); $status->start_time->SetTime(time()); diff -Naur tds-1.00-pl3/lib/CGI/Cookie.pm tds-1.00-pl3_konishi/lib/CGI/Cookie.pm --- tds-1.00-pl3/lib/CGI/Cookie.pm Thu Dec 30 06:57:55 1999 +++ tds-1.00-pl3_konishi/lib/CGI/Cookie.pm Thu Jan 1 00:00:00 1970 @@ -1,128 +0,0 @@ -package CGI::Cookie; -# $Id: Cookie.pm,v 1.11 1999/12/30 06:57:55 tom Exp $ - -=head1 NAME - -CGI::Cookie - クッキー - -=head1 SYNOPSIS - -=cut - -use strict; -use Exporter; - -use vars qw(@ISA @EXPORT $Loaded %Cookies); -@ISA = qw(Exporter); -@EXPORT = qw(GetCookie AsCookieHeader); - -use DateTime::Time; -use DateTime::Format; -use CGI::Tools; - -=head2 Reload() - -再度 $ENV{'HTTP_COOKIE'}, $ENV{'COOKIE'} から -クッキーを読み取り、データ配列にセットする - -=cut - -sub Reload() -{ - %Cookies = (); - my $raw_cookie = $ENV{'HTTP_COOKIE'} || $ENV{'COOKIE'}; - for (split("; ", $raw_cookie)){ - my ($key, $value) = split("="); - $Cookies{$key} = unescape($value); - } - $Loaded = 1; -} -################################################################ - -=head2 GetCookie($name) - -$name というクッキーの値を取り出す - -=cut - -sub GetCookie($) -{ - my $name = shift; - Reload() unless $Loaded; - return $Cookies{$name}; -} - -=head2 AsCookieHeader($name, $value, $expires, $as_meta) - -指定したクッキーを HTTP ヘッダとして整形する - -$as_meta = 1 だと 形式で返す。 -それ以外は Set-Cookie: - -=cut - -sub AsCookieHeader($$;$$) -{ - my ($name, $value, $expires, $as_meta) = @_; - - # パス部を切り出し(多分合ってる:hns からひっぱってきた) - my $path = $ENV{'SCRIPT_NAME'}; - $path =~s!/?[^/]+$!!; - if ($path){ - $path = "path=$path;"; - } - # 賞味期限 - if ($expires){ - $expires = sprintf("expires=%s", - time2str("%a, %d-%b-%Y %H:%M:%S %Z", - (expire_calc($expires)), "GMT")); - } - unless ($as_meta){ - return sprintf("Set-Cookie: %s=%s; %s %s\n", - $name, escape($value), $path, - $expires); -# return sprintf("Set-Cookie: %s=%s;%s\n", -# $name, escape($value), -# $expires); - } else { - return sprintf(qq(\n), - $name, escape($value), $path, - $expires); - } -} - -################################################################ -# thanks to CGI.pm :-) -sub expire_calc { - my($time) = @_; - my(%mult) = ('s'=>1, - 'm'=>60, - 'h'=>60*60, - 'd'=>60*60*24, - 'M'=>60*60*24*30, - 'y'=>60*60*24*365); - # format for time can be in any of the forms... - # "now" -- expire immediately - # "+180s" -- in 180 seconds - # "+2m" -- in 2 minutes - # "+12h" -- in 12 hours - # "+1d" -- in 1 day - # "+3M" -- in 3 months - # "+2y" -- in 2 years - # "-3m" -- 3 minutes ago(!) - # If you don't supply one of these forms, we assume you are - # specifying the date yourself - my($offset); - if (!$time || ($time eq 'now')) { - $offset = 0; - } elsif ($time=~/^([+-]?\d+)([mhdMy]?)/) { - $offset = ($mult{$2} || 1)*$1; - } else { - return $time; - } - return (time+$offset); -} - -1; - - diff -Naur tds-1.00-pl3/lib/CGI/Cookie_tds.pm tds-1.00-pl3_konishi/lib/CGI/Cookie_tds.pm --- tds-1.00-pl3/lib/CGI/Cookie_tds.pm Thu Jan 1 00:00:00 1970 +++ tds-1.00-pl3_konishi/lib/CGI/Cookie_tds.pm Tue Mar 14 15:31:42 2000 @@ -0,0 +1,128 @@ +package CGI::Cookie_tds; +# $Id: Cookie.pm,v 1.11 1999/12/30 06:57:55 tom Exp $ + +=head1 NAME + +CGI::Cookie - クッキー + +=head1 SYNOPSIS + +=cut + +use strict; +use Exporter; + +use vars qw(@ISA @EXPORT $Loaded %Cookies); +@ISA = qw(Exporter); +@EXPORT = qw(GetCookie AsCookieHeader); + +use DateTime::Time; +use DateTime::Format; +use CGI::Tools; + +=head2 Reload() + +再度 $ENV{'HTTP_COOKIE'}, $ENV{'COOKIE'} から +クッキーを読み取り、データ配列にセットする + +=cut + +sub Reload() +{ + %Cookies = (); + my $raw_cookie = $ENV{'HTTP_COOKIE'} || $ENV{'COOKIE'}; + for (split("; ", $raw_cookie)){ + my ($key, $value) = split("="); + $Cookies{$key} = unescape($value); + } + $Loaded = 1; +} +################################################################ + +=head2 GetCookie($name) + +$name というクッキーの値を取り出す + +=cut + +sub GetCookie($) +{ + my $name = shift; + Reload() unless $Loaded; + return $Cookies{$name}; +} + +=head2 AsCookieHeader($name, $value, $expires, $as_meta) + +指定したクッキーを HTTP ヘッダとして整形する + +$as_meta = 1 だと 形式で返す。 +それ以外は Set-Cookie: + +=cut + +sub AsCookieHeader($$;$$) +{ + my ($name, $value, $expires, $as_meta) = @_; + + # パス部を切り出し(多分合ってる:hns からひっぱってきた) + my $path = $ENV{'SCRIPT_NAME'}; + $path =~s!/?[^/]+$!!; + if ($path){ + $path = "path=$path;"; + } + # 賞味期限 + if ($expires){ + $expires = sprintf("expires=%s", + time2str("%a, %d-%b-%Y %H:%M:%S %Z", + (expire_calc($expires)), "GMT")); + } + unless ($as_meta){ + return sprintf("Set-Cookie: %s=%s; %s %s\n", + $name, escape($value), $path, + $expires); +# return sprintf("Set-Cookie: %s=%s;%s\n", +# $name, escape($value), +# $expires); + } else { + return sprintf(qq(\n), + $name, escape($value), $path, + $expires); + } +} + +################################################################ +# thanks to CGI.pm :-) +sub expire_calc { + my($time) = @_; + my(%mult) = ('s'=>1, + 'm'=>60, + 'h'=>60*60, + 'd'=>60*60*24, + 'M'=>60*60*24*30, + 'y'=>60*60*24*365); + # format for time can be in any of the forms... + # "now" -- expire immediately + # "+180s" -- in 180 seconds + # "+2m" -- in 2 minutes + # "+12h" -- in 12 hours + # "+1d" -- in 1 day + # "+3M" -- in 3 months + # "+2y" -- in 2 years + # "-3m" -- 3 minutes ago(!) + # If you don't supply one of these forms, we assume you are + # specifying the date yourself + my($offset); + if (!$time || ($time eq 'now')) { + $offset = 0; + } elsif ($time=~/^([+-]?\d+)([mhdMy]?)/) { + $offset = ($mult{$2} || 1)*$1; + } else { + return $time; + } + return (time+$offset); +} + +1; + + diff -Naur tds-1.00-pl3/lib/TDS/Authorize.pm tds-1.00-pl3_konishi/lib/TDS/Authorize.pm --- tds-1.00-pl3/lib/TDS/Authorize.pm Fri Jan 14 19:34:58 2000 +++ tds-1.00-pl3_konishi/lib/TDS/Authorize.pm Tue Mar 14 15:32:02 2000 @@ -32,7 +32,7 @@ #use Exporter; use ObjectTemplate; -use CGI::Cookie; +use CGI::Cookie_tds; use CGI::QueryString; use Crypt; diff -Naur tds-1.00-pl3/lib/TDS/Dynamic.pm tds-1.00-pl3_konishi/lib/TDS/Dynamic.pm --- tds-1.00-pl3/lib/TDS/Dynamic.pm Fri Jan 21 15:24:10 2000 +++ tds-1.00-pl3_konishi/lib/TDS/Dynamic.pm Tue Mar 14 15:32:18 2000 @@ -17,7 +17,7 @@ use CGI::Tools; use CGI::QueryString; -use CGI::Cookie; +use CGI::Cookie_tds; use DateTime::Format; use TDS::System; diff -Naur tds-1.00-pl3/lib/TDS/Renderer.pm tds-1.00-pl3_konishi/lib/TDS/Renderer.pm --- tds-1.00-pl3/lib/TDS/Renderer.pm Sun Jan 23 05:14:29 2000 +++ tds-1.00-pl3_konishi/lib/TDS/Renderer.pm Tue Mar 14 15:32:38 2000 @@ -41,7 +41,7 @@ use JConv; use DateTime::Format; -use CGI::Cookie; +use CGI::Cookie_tds; use CGI::QueryString; use CGI::Tools; use Template; diff -Naur tds-1.00-pl3/lib/TDS/Status.pm tds-1.00-pl3_konishi/lib/TDS/Status.pm --- tds-1.00-pl3/lib/TDS/Status.pm Fri Jan 21 16:46:35 2000 +++ tds-1.00-pl3_konishi/lib/TDS/Status.pm Tue Mar 14 15:33:00 2000 @@ -10,7 +10,7 @@ use ObjectTemplate; use DateTime::Time; use DateTime::Format; -use CGI::Cookie; +use CGI::Cookie_tds; use CGI::QueryString; use Uri; use UserAgent; diff -Naur tds-1.00-pl3/set-cookie.cgi tds-1.00-pl3_konishi/set-cookie.cgi --- tds-1.00-pl3/set-cookie.cgi Wed Dec 29 18:31:03 1999 +++ tds-1.00-pl3_konishi/set-cookie.cgi Tue Mar 14 15:30:23 2000 @@ -7,7 +7,7 @@ use strict; use lib qw(lib); -use CGI::Cookie; +use CGI::Cookie_tds; use TDS::Status; @@ -16,7 +16,7 @@ ################################################################ my $status = new TDS::Status; -#my $expires = gmtime(CGI::Cookie::expire_calc($TDS::System::CookieExpires)); +#my $expires = gmtime(CGI::Cookie_tds::expire_calc($TDS::System::CookieExpires)); print "content-type: text/html\n\n"; #printf(qq(\n),