stas 2004/08/13 17:24:16
Modified: t/response/TestApache util.pm t/response/TestCompat apache_util.pm todo api_status Log: Apache::Util polish Revision Changes Path 1.6 +34 -3 modperl-2.0/t/response/TestApache/util.pm Index: util.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestApache/util.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- util.pm 8 Jul 2004 04:52:06 -0000 1.5 +++ util.pm 14 Aug 2004 00:24:16 -0000 1.6 @@ -27,8 +27,9 @@ sub handler { my $r = shift; - plan $r, tests => 4; + plan $r, tests => 8; + # ht_time { my $time = time; my $fmt = "%a, %d %b %Y %H:%M:%S %Z"; @@ -52,6 +53,36 @@ 'Apache::Util::ht_time($pool, $time, $fmt, $gmt)', 0); } + # escape_path + { + my($uri, $received, $expected); + + $uri = "a 'long' file?.html"; + ($expected = $uri) =~ s/([\s?;])/sprintf "%%%x", ord $1/ge; + + $received = Apache::Util::escape_path($uri, $r->pool); + ok t_cmp $received, $expected, + "Apache::Util::escape_path / partial=1 / default"; + + $received = Apache::Util::escape_path($uri, $r->pool, 1); + ok t_cmp $received, $expected, + "Apache::Util::escape_path / partial=1 / explicit"; + + $received = Apache::Util::escape_path($uri, $r->pool, 0); + ok t_cmp $received, $expected, + "Apache::Util::escape_path / partial=0"; + + $uri = "a 'long' file?.html:"; + ($expected = $uri) =~ s/([\s?;])/sprintf "%%%x", ord $1/ge; + # XXX: why does it prepend ./ only if it sees : or :/? + $expected = "./$expected"; + + $received = Apache::Util::escape_path($uri, $r->pool, 0); + ok t_cmp $received, $expected, + "Apache::Util::escape_path / partial=0 / ./ prefix "; + + } + Apache::OK; } @@ -62,10 +93,10 @@ if ($parse_time_ok && $exact_match) { my $ptime = APR::Date::parse_http($fmtdate); t_debug "fmtdate: $fmtdate"; - ok t_cmp($ptime, $time, $comment); + ok t_cmp $ptime, $time, $comment; } else { - ok t_cmp($fmtdate_ptn, $fmtdate, $comment); + ok t_cmp $fmtdate_ptn, $fmtdate, $comment; } } 1.7 +1 -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.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- apache_util.pm 9 Jul 2004 15:12:56 -0000 1.6 +++ apache_util.pm 14 Aug 2004 00:24:16 -0000 1.7 @@ -52,7 +52,7 @@ (my $esc_uri = $uri) =~ s/ /\%20/g; my $uri2 = $uri; - $uri = Apache::Util::escape_uri($uri); + $uri = Apache::Util::escape_uri($uri); $uri2 = Apache::Util::escape_path($uri2, $r->pool); ok t_cmp($uri, $esc_uri, "Apache::Util::escape_uri"); 1.30 +1 -1 modperl-2.0/todo/api_status Index: api_status =================================================================== RCS file: /home/cvs/modperl-2.0/todo/api_status,v retrieving revision 1.29 retrieving revision 1.30 diff -u -u -r1.29 -r1.30 --- api_status 13 Aug 2004 05:31:34 -0000 1.29 +++ api_status 14 Aug 2004 00:24:16 -0000 1.30 @@ -57,7 +57,7 @@ VV src/docs/2.0/api/Apache/SubProcess.pod -- src/docs/2.0/api/Apache/SubRequest.pod VV src/docs/2.0/api/Apache/URI.pod --- src/docs/2.0/api/Apache/Util.pod +VV src/docs/2.0/api/Apache/Util.pod -- src/docs/2.0/api/Apache/compat.pod -- src/docs/2.0/api/Apache/porting.pod