Author: randyk Date: Tue Mar 8 10:41:56 2005 New Revision: 156559 URL: http://svn.apache.org/viewcvs?view=rev&rev=156559 Log: fixes for the compat tests.
Modified: perl/modperl/branches/apache2-rename-unstable/lib/Apache2/compat.pm perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_file.pm perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_util.pm perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/conn_rec.pm Modified: perl/modperl/branches/apache2-rename-unstable/lib/Apache2/compat.pm URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/lib/Apache2/compat.pm?view=diff&r1=156558&r2=156559 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/lib/Apache2/compat.pm (original) +++ perl/modperl/branches/apache2-rename-unstable/lib/Apache2/compat.pm Tue Mar 8 10:41:56 2005 @@ -72,7 +72,7 @@ $INC{'Apache/Table.pm'} = __FILE__; } -($Apache2::Server::Starting, $Apache2::Server::ReStarting) = +($Apache::Server::Starting, $Apache::Server::ReStarting) = Apache2::ServerUtil::restart_count() == 1 ? (1, 0) : (0, 1); # api => "overriding code" @@ -320,6 +320,23 @@ package Apache; +sub unescape_url_info { + my($class, $string) = @_; + Apache2::URI::unescape_url($string); + $string =~ tr/+/ /; + $string; +} + +#sorry, have to use $r->Apache2::args at the moment +#for list context splitting + +sub args { + my $r = shift; + my $args = $r->args; + return $args unless wantarray; + return $r->parse_args($args); +} + sub server_root_relative { my $class = shift; if (@_ && defined($_[0]) && File::Spec->file_name_is_absolute($_[0])) { @@ -538,23 +555,6 @@ } split /[=&;]/, $string, -1; } -sub Apache2::unescape_url_info { - my($class, $string) = @_; - Apache2::URI::unescape_url($string); - $string =~ tr/+/ /; - $string; -} - -#sorry, have to use $r->Apache2::args at the moment -#for list context splitting - -sub Apache2::args { - my $r = shift; - my $args = $r->args; - return $args unless wantarray; - return $r->parse_args($args); -} - use Apache2::Const -compile => qw(MODE_READBYTES); use APR::Const -compile => qw(SUCCESS BLOCK_READ); @@ -729,7 +729,7 @@ sub tmpfile { my $class = shift; my $limit = 100; - my $r = Apache2::compat::request('Apache2::File->tmpfile'); + my $r = Apache2::compat::request('Apache::File->tmpfile'); while ($limit--) { my $tmpfile = "$TMPDIR/${$}" . $TMPNAM++; @@ -787,6 +787,8 @@ *unescape_uri = \&Apache2::URI::unescape_url; +*escape_path = \&Apache2::Util::escape_path; + sub escape_uri { my $path = shift; my $r = Apache2::compat::request('Apache2::Util::escape_uri'); @@ -840,7 +842,7 @@ return Apache2::DECLINED; } -package Apache::Connection; +package Apache2::Connection; # auth_type and user records don't exist in 2.0 conn_rec struct # 'PerlOptions +GlobalRequest' is required Modified: perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_file.pm URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_file.pm?view=diff&r1=156558&r2=156559 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_file.pm (original) +++ perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_file.pm Tue Mar 8 10:41:56 2005 @@ -1,6 +1,6 @@ package TestCompat::apache_file; -# Apache2::File compat layer tests +# Apache::File compat layer tests # these tests are all run and validated on the server side. @@ -23,11 +23,11 @@ my $cfg = Apache::Test::config(); my $vars = $cfg->{vars}; - require Apache2::File; + require Apache::File; my $file = $vars->{t_conf_file}; t_debug "new Apache2::File file object"; - ok my $fh = Apache2::File->new; + ok my $fh = Apache::File->new; t_debug "open itself"; if ($fh->open($file)) { @@ -51,7 +51,7 @@ ok !$fh->open("$file.nochance"); t_debug "new+open"; - if (my $fh = Apache2::File->new($file)) { + if (my $fh = Apache::File->new($file)) { ok 1; $fh->close; } @@ -60,10 +60,10 @@ } t_debug "new+open non-exists"; - ok !Apache2::File->new("$file.yeahright"); + ok !Apache::File->new("$file.yeahright"); # tmpfile - my ($tmpfile, $tmpfh) = Apache2::File->tmpfile; + my ($tmpfile, $tmpfh) = Apache::File->tmpfile; t_debug "open tmpfile fh"; ok $tmpfh; Modified: perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_util.pm URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_util.pm?view=diff&r1=156558&r2=156559 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_util.pm (original) +++ perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/apache_util.pm Tue Mar 8 10:41:56 2005 @@ -43,7 +43,7 @@ # size_string() { while (my($k, $v) = each %string_size) { - ok t_cmp($v, Apache2::Util::size_string($k)); + ok t_cmp($v, Apache::Util::size_string($k)); } } @@ -70,7 +70,7 @@ my $html = '<p>"hi"&foo</p>'; my $esc_html = '<p>"hi"&foo</p>'; - ok t_cmp(Apache2::Util::escape_html($html), $esc_html, + ok t_cmp(Apache::Util::escape_html($html), $esc_html, "Apache2::Util::escape_html"); @@ -90,8 +90,8 @@ if ($crypt_ok) { # not all platforms support C-level crypt my $hash = "aX9eP53k4DGfU"; - ok t_cmp(Apache2::Util::validate_password("dougm", $hash), 1); - ok t_cmp(Apache2::Util::validate_password("mguod", $hash), 0); + ok t_cmp(Apache::Util::validate_password("dougm", $hash), 1); + ok t_cmp(Apache::Util::validate_password("mguod", $hash), 0); } OK; Modified: perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/conn_rec.pm URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/conn_rec.pm?view=diff&r1=156558&r2=156559 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/conn_rec.pm (original) +++ perl/modperl/branches/apache2-rename-unstable/t/response/TestCompat/conn_rec.pm Tue Mar 8 10:41:56 2005 @@ -10,7 +10,7 @@ use Socket qw(sockaddr_in inet_ntoa); -use Apache2::Constants qw(OK); +use Apache::Constants qw(OK); sub handler {