stas 2004/02/09 11:25:01
Modified: lib/Apache compat.pm
t/apache .cvsignore
t/response/TestCompat apache_util.pm
xs/maps apache_functions.map
todo release
. Changes
Added: xs/Apache/Util Apache__Util.h
t/response/TestApache util.pm
Log:
ht_time() w/o the pool is now available only via override/restore compat
API. format_time, has been renamed back to ht_time, and the default
values for fmt, time and gmt are now supported.
Revision Changes Path
1.103 +14 -12 modperl-2.0/lib/Apache/compat.pm
Index: compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -u -r1.102 -r1.103
--- compat.pm 9 Feb 2004 18:44:43 -0000 1.102
+++ compat.pm 9 Feb 2004 19:25:01 -0000 1.103
@@ -151,6 +151,20 @@
};
$orig_sub;
}
+
+EOI
+
+ 'Apache::Util::ht_time' => <<'EOI',
+{
+ require Apache::Util;
+ my $orig_sub = *Apache::Util::ht_time{CODE};
+ *Apache::Util::ht_time = sub {
+ my $r = Apache::compat::request('Apache::Util::ht_time');
+ return $orig_sub->($r->pool, @_);
+ };
+ $orig_sub;
+}
+
EOI
);
@@ -676,18 +690,6 @@
my $html = shift;
$html =~ s/($html_escape)/$html_escapes{$1}/go;
$html;
-}
-
-sub ht_time {
- my($t, $fmt, $gmt) = @_;
-
- $t ||= time;
- $fmt ||= '%a, %d %b %Y %H:%M:%S %Z';
- $gmt = 1 unless @_ == 3;
-
- my $r = Apache::compat::request('Apache::Util::ht_time');
-
- return Apache::Util::format_time($t, $fmt, $gmt, $r->pool);
}
*parsedate = \&APR::Date::parse_http;
1.6 +1 -1 modperl-2.0/t/apache/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/modperl-2.0/t/apache/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- .cvsignore 16 Aug 2002 03:19:44 -0000 1.5
+++ .cvsignore 9 Feb 2004 19:25:01 -0000 1.6
@@ -6,4 +6,4 @@
scanhdrs.t
write.t
subprocess.t
-
+util.t
1.5 +2 -1 modperl-2.0/t/response/TestCompat/apache_util.pm
Index: apache_util.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_util.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- apache_util.pm 19 Jan 2004 15:15:07 -0000 1.4
+++ apache_util.pm 9 Feb 2004 19:25:01 -0000 1.5
@@ -76,8 +76,9 @@
# ht_time(), parsedate()
my $time = time;
-
+ Apache::compat::override_mp2_api('Apache::Util::ht_time');
my $fmtdate = Apache::Util::ht_time($time);
+ Apache::compat::restore_mp2_api('Apache::Util::ht_time');
ok t_cmp($fmtdate, $fmtdate, "Apache::Util::ht_time");
1.77 +1 -1 modperl-2.0/xs/maps/apache_functions.map
Index: apache_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -u -r1.76 -r1.77
--- apache_functions.map 19 Jan 2004 19:19:45 -0000 1.76
+++ apache_functions.map 9 Feb 2004 19:25:01 -0000 1.77
@@ -276,7 +276,7 @@
-ap_set_deprecated
MODULE=Apache::Util
- ap_ht_time | | t, fmt, gmt, p | format_time
+ ap_ht_time | | p, t=TIME_NOW, fmt=DEFAULT_TIME_FORMAT, gmt=1
!ap_rfc1413
!ap_escape_html | | s, p
#escape_uri
1.1 modperl-2.0/xs/Apache/Util/Apache__Util.h
Index: Apache__Util.h
===================================================================
#define TIME_NOW apr_time_now()
#define DEFAULT_TIME_FORMAT "%a, %d %b %Y %H:%M:%S %Z"
1.1 modperl-2.0/t/response/TestApache/util.pm
Index: util.pm
===================================================================
package TestApache::util;
# Apache::Util tests
use strict;
use warnings FATAL => 'all';
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Util ();
use APR::Date ();
use Apache::TestUtil;
use Apache::Test;
use Apache::Const -compile => 'OK';
# XXX: need to use PerlPassEnv to get these %ENV vars
my $locale = $ENV{LANG} || $ENV{LC_TIME} || '';
# XXX: will any en_XXX work with http_parse? try setlocale?
# XXX: should we set $ENV{LANG} to en_US instead of skipping?
my $parse_time_ok = $locale =~ /^en_/ ? 1 : 0;
sub handler {
my $r = shift;
plan $r, tests => 4;
{
my $time = time;
my $fmt = "%a, %d %b %Y %H:%M:%S %Z";
my $fmtdate;
$fmtdate = Apache::Util::ht_time($r->pool);
time_cmp($time, $fmtdate,
'Apache::Util::ht_time($pool)', 0);
$fmtdate = Apache::Util::ht_time($r->pool, $time);
time_cmp($time, $fmtdate,
'Apache::Util::ht_time($pool, $time)', 1);
$fmtdate = Apache::Util::ht_time($r->pool, $time, $fmt);
time_cmp($time, $fmtdate,
'Apache::Util::ht_time($pool, $time, $fmt)', 1);
my $gmt = 0;
$fmtdate = Apache::Util::ht_time($r->pool, $time, $fmt, $gmt);
time_cmp($time, $fmtdate,
'Apache::Util::ht_time($pool, $time, $fmt, $gmt)', 0);
}
Apache::OK;
}
my $fmtdate_ptn = qr/^\w\w\w, \d\d \w\w\w \d\d\d\d \d\d:\d\d:\d\d/;
sub time_cmp {
my($time, $fmtdate, $comment, $exact_match) = @_;
if ($parse_time_ok && $exact_match) {
my $ptime = APR::Date::parse_http($fmtdate);
t_debug "fmtdate: $fmtdate";
ok t_cmp($time, $ptime, $comment);
}
else {
ok t_cmp($fmtdate_ptn, $fmtdate, $comment);
}
}
1;
__END__
1.14 +0 -7 modperl-2.0/todo/release
Index: release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -u -r1.13 -r1.14
--- release 9 Feb 2004 19:15:26 -0000 1.13
+++ release 9 Feb 2004 19:25:01 -0000 1.14
@@ -90,13 +90,6 @@
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=100622977803237&w=2
http://marc.theaimsgroup.com/?t=97984528900002&r=1&w=2
-* ht_time() - now requires a pool, temporarily renamed format_time for
- 1.x ht_time compat. should we just leave as is or see if ht_time can
- be changed to not require a pool?
- Status: probably rename it back and just require the
- pool. Apache::compat will override this method and if the pool
- wasn't passed it'll create one behind the scenes (APR::Pool->new).
-
* Apache::{Server,Process} classes:
require mutex lock for writing (e.g. $s->(error_fname|error_log)
Status: most likely some server/process datastructures aren't
1.324 +4 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.323
retrieving revision 1.324
diff -u -u -r1.323 -r1.324
--- Changes 9 Feb 2004 19:08:35 -0000 1.323
+++ Changes 9 Feb 2004 19:25:01 -0000 1.324
@@ -12,6 +12,10 @@
=item 1.99_13-dev
+ht_time w/o the pool is now available only via override/restore compat
+API. format_time, has been renamed back to ht_time, and the default
+values for fmt, time and gmt are now supported. [Stas]
+
it's now possible to push new handlers into the same phase that is
running at the moment [Stas].