[svn:modperl-modules] rev 225 - in Apache-Filter-HTTPHeadersFixup/trunk: . lib/Apache2 lib/Apache2/Filter t/conf t/response/TestManip
[email protected]@cvs.perl.org 3 Jul 2005 23:49:43 -0000
| Newsgroups | perl.modperl.modules.svn |
|---|---|
| Message-ID | <[email protected]> |
Author: [email protected] Date: Sun Jul 3 16:49:43 2005 New Revision: 225 Added: Apache-Filter-HTTPHeadersFixup/trunk/lib/Apache2/ - copied from rev 223, Apache-Filter-HTTPHeadersFixup/trunk/lib/Apache/ Modified: Apache-Filter-HTTPHeadersFixup/trunk/Changes Apache-Filter-HTTPHeadersFixup/trunk/MANIFEST Apache-Filter-HTTPHeadersFixup/trunk/Makefile.PL Apache-Filter-HTTPHeadersFixup/trunk/lib/Apache2/Filter/HTTPHeadersFixup.pm Apache-Filter-HTTPHeadersFixup/trunk/t/conf/extra.conf.in Apache-Filter-HTTPHeadersFixup/trunk/t/conf/modperl_extra.pl Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_append.pm Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_modify.pm Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_append.pm Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_modify.pm Log: update for new mp2 API after RC5. Modified: Apache-Filter-HTTPHeadersFixup/trunk/Changes ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/Changes (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/Changes Sun Jul 3 16:49:43 2005 @@ -1,14 +1,17 @@ =head1 NAME -Apache::Filter::HTTPHeadersFixup Changes file +Apache2::Filter::HTTPHeadersFixup Changes file =over =item 0.06 - -Take Maintainership [Philip M. Gollucci <[email protected]>] +Take Maintainership +[Philip M. Gollucci <[email protected]>] +Update to the mp2 post RC5 API +[Philip M. Gollucci <[email protected]>] =item 0.05 - Mon Jan 3 01:03:12 EST 2005 Modified: Apache-Filter-HTTPHeadersFixup/trunk/MANIFEST ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/MANIFEST (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/MANIFEST Sun Jul 3 16:49:43 2005 @@ -1,4 +1,4 @@ -lib/Apache/Filter/HTTPHeadersFixup.pm +lib/Apache2/Filter/HTTPHeadersFixup.pm Makefile.PL MANIFEST Changes Modified: Apache-Filter-HTTPHeadersFixup/trunk/Makefile.PL ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/Makefile.PL (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/Makefile.PL Sun Jul 3 16:49:43 2005 @@ -3,7 +3,6 @@ use warnings FATAL => 'all'; require 5.006; -use Apache2; use ModPerl::MM (); # enable 'make test|clean' @@ -11,8 +10,8 @@ use Apache::TestMM qw(test clean); # prerequisites my %require = ( - "mod_perl" => "1.9917", - "Apache::Test" => "1.13", + "mod_perl" => "2.000001", + "Apache::Test" => "1.25", ); my @scripts = qw(t/TEST); @@ -22,8 +21,8 @@ Apache::TestMM::filter_args(); Apache::TestMM::generate_script('t/TEST'); ModPerl::MM::WriteMakefile( - NAME => 'Apache::Filter::HTTPHeadersFixup', - VERSION_FROM => 'lib/Apache/Filter/HTTPHeadersFixup.pm', + NAME => 'Apache2::Filter::HTTPHeadersFixup', + VERSION_FROM => 'lib/Apache2/Filter/HTTPHeadersFixup.pm', PREREQ_PM => \%require, clean => { FILES => "@{ clean_files() }", Modified: Apache-Filter-HTTPHeadersFixup/trunk/lib/Apache2/Filter/HTTPHeadersFixup.pm ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/lib/Apache/Filter/HTTPHeadersFixup.pm (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/lib/Apache2/Filter/HTTPHeadersFixup.pm Sun Jul 3 16:49:43 2005 @@ -1,15 +1,15 @@ -package Apache::Filter::HTTPHeadersFixup; +package Apache2::Filter::HTTPHeadersFixup; -$Apache::Filter::HTTPHeadersFixup::VERSION = '0.06'; +$Apache2::Filter::HTTPHeadersFixup::VERSION = '0.06'; use strict; use warnings FATAL => 'all'; use mod_perl 1.9917; -use base qw(Apache::Filter); +use base qw(Apache2::Filter); -use Apache::Connection (); +use Apache2::Connection (); use APR::Brigade (); use APR::Bucket (); @@ -20,7 +20,7 @@ use constant DEBUG => 0; use subs qw(mydebug); *mydebug = DEBUG ? \&Apache::TestTrace::debug : sub {}; -use Apache::Const -compile => qw(OK DECLINED CONN_KEEPALIVE); +use Apache2::Const -compile => qw(OK DECLINED CONN_KEEPALIVE); use APR::Const -compile => ':common'; # this is the function that needs to be overriden @@ -66,7 +66,7 @@ sub context { } my $c = $f->c; - if ($c->keepalive == Apache::CONN_KEEPALIVE && + if ($c->keepalive == Apache2::Const::CONN_KEEPALIVE && $ctx->{done_with_headers} && $c->keepalives > $ctx->{keepalives}) { @@ -90,8 +90,8 @@ sub handle_output { if ($ctx->{done_with_headers}) { mydebug "passing the body through unmodified"; my $rv = $f->next->pass_brigade($bb); - return $rv unless $rv == APR::SUCCESS; - return Apache::OK; + return $rv unless $rv == APR::Const::SUCCESS; + return Apache2::Const::OK; } $bb->flatten(my $data); @@ -116,9 +116,9 @@ sub handle_output { $out_bb->insert_tail(APR::Bucket->new($ba, $data)); my $rv = $f->next->pass_brigade($out_bb); - return $rv unless $rv == APR::SUCCESS; + return $rv unless $rv == APR::Const::SUCCESS; - return Apache::OK; + return Apache2::Const::OK; # XXX: is it possible that some data will be along with # headers in the same incoming bb? } @@ -127,7 +127,7 @@ sub handle_output { } } - return Apache::OK; + return Apache2::Const::OK; } sub handle_input { @@ -138,18 +138,18 @@ sub handle_input { # handling the HTTP request body if ($ctx->{done_with_headers}) { mydebug "passing the body through unmodified"; - return Apache::DECLINED; + return Apache2::Const::DECLINED; } # any custom input HTTP header buckets to inject? - return Apache::OK if inject_header_bucket($bb, $ctx); + return Apache2::Const::OK if inject_header_bucket($bb, $ctx); # normal HTTP headers processing my $c = $f->c; until ($ctx->{seen_body_separator}) { my $ctx_bb = APR::Brigade->new($c->pool, $c->bucket_alloc); my $rv = $f->next->get_brigade($ctx_bb, $mode, $block, $readbytes); - return $rv unless $rv == APR::SUCCESS; + return $rv unless $rv == APR::Const::SUCCESS; while (!$ctx_bb->is_empty) { my $b = $ctx_bb->first; @@ -207,7 +207,7 @@ sub handle_input { } } - return Apache::OK; + return Apache2::Const::OK; } # returns 1 if a bucket with a header was inserted to the $bb's tail, @@ -237,7 +237,7 @@ __END__ =head1 NAME -Apache::Filter::HTTPHeadersFixup - Manipulate Apache 2 HTTP Headers +Apache2::Filter::HTTPHeadersFixup - Manipulate Apache 2 HTTP Headers =head1 Synopsis @@ -247,7 +247,7 @@ Apache::Filter::HTTPHeadersFixup - Manip use strict; use warnings FATAL => 'all'; - use base qw(Apache::Filter::HTTPHeadersFixup); + use base qw(Apache2::Filter::HTTPHeadersFixup); sub manip { my ($class, $ra_headers) = @_; @@ -272,7 +272,7 @@ Apache::Filter::HTTPHeadersFixup - Manip =head1 Description -C<Apache::Filter::HTTPHeadersFixup> is a super class which provides an +C<Apache2::Filter::HTTPHeadersFixup> is a super class which provides an easy way to manipulate HTTP headers without invoking any mod_perl HTTP handlers. This is accomplished by using input and/or output connection filters. @@ -283,7 +283,7 @@ This class cannot be used as is. It has =head1 Usage -A new class inheriting from C<Apache::Filter::HTTPHeadersFixup> needs +A new class inheriting from C<Apache2::Filter::HTTPHeadersFixup> needs to be created. That class needs to include a single function C<manip()>. This function is invoked with two arguments, the package it was invoked from and a reference to an array of headers, each @@ -302,11 +302,11 @@ in the test suite. =head1 Debug -C<Apache::Filter::HTTPHeadersFixup> includes internal tracing calls, +C<Apache2::Filter::HTTPHeadersFixup> includes internal tracing calls, which make it easy to debug the parsing of the headers. First change the constant DEBUG to 1 in -C<Apache::Filter::HTTPHeadersFixup>. Then enable Apache-Test debug +C<Apache2::Filter::HTTPHeadersFixup>. Then enable Apache-Test debug tracing. For example to run a test with tracing enabled do: % t/TEST -trace=debug -v manip/out_append @@ -322,7 +322,7 @@ All the tracing goes into I<error_log>. =head1 See Also -L<Apache2>, L<mod_perl>, L<Apache::Filter> +L<Apache2>, L<mod_perl>, L<Apache2::Filter> @@ -338,7 +338,7 @@ Previously developed by Stas Bekman. =head1 Copyright -The C<Apache::Filter::HTTPHeadersFixup> module is free software; you +The C<Apache2::Filter::HTTPHeadersFixup> module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Modified: Apache-Filter-HTTPHeadersFixup/trunk/t/conf/extra.conf.in ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/t/conf/extra.conf.in (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/t/conf/extra.conf.in Sun Jul 3 16:49:43 2005 @@ -2,9 +2,9 @@ PerlSwitches -wT ##### DEVMODE: Remove in production ### -PerlModule Apache::Reload -PerlInitHandler Apache::Reload +PerlModule Apache2::Reload +PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off -PerlSetVar ReloadModules "Apache::Filter::HTTPHeadersFixup TestManip::*" +PerlSetVar ReloadModules "Apache2::Filter::HTTPHeadersFixup TestManip::*" #PerlSetVar ReloadDebug On Modified: Apache-Filter-HTTPHeadersFixup/trunk/t/conf/modperl_extra.pl ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/t/conf/modperl_extra.pl (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/t/conf/modperl_extra.pl Sun Jul 3 16:49:43 2005 @@ -3,12 +3,12 @@ use lib qw(lib); use constant IOBUFSIZE => 8192; -use Apache::Const -compile => qw(MODE_READBYTES); +use Apache2::Const -compile => qw(MODE_READBYTES); use APR::Const -compile => qw(SUCCESS BLOCK_READ); use APR::Brigade (); use APR::Bucket (); -use Apache::Filter (); +use Apache2::Filter (); # to enable debug start with: (or simply run with -trace=debug) # t/TEST -trace=debug -start @@ -23,8 +23,8 @@ sub ModPerl::Test::read_post { my $seen_eos = 0; my $count = 0; do { - $r->input_filters->get_brigade($bb, Apache::MODE_READBYTES, - APR::BLOCK_READ, IOBUFSIZE); + $r->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES, + APR::Const::BLOCK_READ, IOBUFSIZE); $count++; @@ -57,12 +57,12 @@ package ModPerl::TestFilterDebug; use strict; use warnings FATAL => 'all'; -use base qw(Apache::Filter); +use base qw(Apache2::Filter); use APR::Brigade (); use APR::Bucket (); use APR::BucketType (); -use Apache::Const -compile => qw(OK DECLINED); +use Apache2::Const -compile => qw(OK DECLINED); use APR::Const -compile => ':common'; # to use these functions add any or all of these filter handlers @@ -86,20 +86,20 @@ sub snoop { if (defined $mode) { # input filter my $rv = $filter->next->get_brigade($bb, $mode, $block, $readbytes); - return $rv unless $rv == APR::SUCCESS; + return $rv unless $rv == APR::Const::SUCCESS; bb_dump($type, $stream, $bb); } else { # output filter bb_dump($type, $stream, $bb); my $rv = $filter->next->pass_brigade($bb); - return $rv unless $rv == APR::SUCCESS; + return $rv unless $rv == APR::Const::SUCCESS; } #if ($bb->is_empty) { # return -1; #} - return Apache::OK; + return Apache2::Const::OK; } sub bb_dump { Modified: Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_append.pm ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_append.pm (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_append.pm Sun Jul 3 16:49:43 2005 @@ -6,16 +6,16 @@ package TestManip::in_append; use strict; use warnings FATAL => 'all'; -use base qw(Apache::Filter::HTTPHeadersFixup); +use base qw(Apache2::Filter::HTTPHeadersFixup); -use Apache::RequestRec (); -use Apache::RequestIO (); +use Apache2::RequestRec (); +use Apache2::RequestIO (); use APR::Table (); use Apache::TestTrace; -use Apache::Const -compile => qw(OK M_POST); +use Apache2::Const -compile => qw(OK M_POST); my $key = "Leech"; my $val = "Hungry"; @@ -32,7 +32,7 @@ sub manip { sub response { my $r = shift; - my $data = $r->method_number == Apache::M_POST + my $data = $r->method_number == Apache2::Const::M_POST ? ModPerl::Test::read_post($r) : ''; @@ -43,7 +43,7 @@ sub response { # copy the input header to output headers $r->headers_out->set($key => $r->headers_in->get($key)||''); - return Apache::OK; + return Apache2::Const::OK; } 1; Modified: Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_modify.pm ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_modify.pm (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/in_modify.pm Sun Jul 3 16:49:43 2005 @@ -6,16 +6,16 @@ package TestManip::in_modify; use strict; use warnings FATAL => 'all'; -use base qw(Apache::Filter::HTTPHeadersFixup); +use base qw(Apache2::Filter::HTTPHeadersFixup); -use Apache::RequestRec (); -use Apache::RequestIO (); +use Apache2::RequestRec (); +use Apache2::RequestIO (); use APR::Table (); use Apache::TestTrace; -use Apache::Const -compile => qw(OK M_POST); +use Apache2::Const -compile => qw(OK M_POST); my $key = "Sign-Here"; @@ -31,7 +31,7 @@ sub manip { sub response { my $r = shift; - my $data = $r->method_number == Apache::M_POST + my $data = $r->method_number == Apache2::Const::M_POST ? ModPerl::Test::read_post($r) : ''; @@ -41,7 +41,7 @@ sub response { # copy the input header to output headers $r->headers_out->set($key => $r->headers_in->get($key)); - return Apache::OK; + return Apache2::Const::OK; } 1; Modified: Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_append.pm ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_append.pm (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_append.pm Sun Jul 3 16:49:43 2005 @@ -6,16 +6,16 @@ package TestManip::out_append; use strict; use warnings FATAL => 'all'; -use base qw(Apache::Filter::HTTPHeadersFixup); +use base qw(Apache2::Filter::HTTPHeadersFixup); -use Apache::RequestRec (); -use Apache::RequestIO (); +use Apache2::RequestRec (); +use Apache2::RequestIO (); use APR::Table (); use Apache::TestTrace; -use Apache::Const -compile => qw(OK M_POST); +use Apache2::Const -compile => qw(OK M_POST); my $key = "Leech"; my $val = "Hungry"; @@ -33,14 +33,14 @@ sub manip { sub response { my $r = shift; - my $data = $r->method_number == Apache::M_POST + my $data = $r->method_number == Apache2::Const::M_POST ? ModPerl::Test::read_post($r) : ''; $r->content_type('text/plain'); $r->print($data); - return Apache::OK; + return Apache2::Const::OK; } 1; Modified: Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_modify.pm ============================================================================== --- Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_modify.pm (original) +++ Apache-Filter-HTTPHeadersFixup/trunk/t/response/TestManip/out_modify.pm Sun Jul 3 16:49:43 2005 @@ -6,16 +6,16 @@ package TestManip::out_modify; use strict; use warnings FATAL => 'all'; -use base qw(Apache::Filter::HTTPHeadersFixup); +use base qw(Apache2::Filter::HTTPHeadersFixup); -use Apache::RequestRec (); -use Apache::RequestIO (); +use Apache2::RequestRec (); +use Apache2::RequestIO (); use APR::Table (); use Apache::TestTrace; -use Apache::Const -compile => qw(OK M_POST); +use Apache2::Const -compile => qw(OK M_POST); my $key = "Sign-Here"; @@ -31,7 +31,7 @@ sub manip { sub response { my $r = shift; - my $data = $r->method_number == Apache::M_POST + my $data = $r->method_number == Apache2::Const::M_POST ? ModPerl::Test::read_post($r) : ''; @@ -41,7 +41,7 @@ sub response { # copy the input header to output headers $r->headers_out->set($key => ""); - return Apache::OK; + return Apache2::Const::OK; } 1;