cvs commit: modperl-2.0/xs/maps apache_structures.map modperl_functions.map
dougm 01/04/13 00:17:08 Modified:src/modules/perl modperl_types.h xs/Apache/Filter Apache__Filter.h xs/maps apache_structures.map modperl_functions.map Added: t/filter/TestFilter api.pm Log: enable Apache::Filter structure interface enable Apache::FilterRec module add Apache::OutputFilter->f method for access to Apache::Filter object add filter api test Revision ChangesPath 1.35 +0 -3 modperl-2.0/src/modules/perl/modperl_types.h Index: modperl_types.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- modperl_types.h 2001/04/09 23:57:22 1.34 +++ modperl_types.h 2001/04/13 07:17:06 1.35 @@ -185,9 +185,6 @@ apr_pool_t *pool; } modperl_filter_t; -typedef modperl_filter_t * Apache__OutputFilter; -typedef modperl_filter_t * Apache__InputFilter; - typedef struct { SV *data; modperl_handler_t *handler; 1.1 modperl-2.0/t/filter/TestFilter/api.pm Index: api.pm === package TestFilter::api; use strict; use warnings FATAL => 'all'; use Apache::Filter (); use Apache::FilterRec (); use Test; my $response_data = "blah blah blah"; sub init_test_pm { my $filter = shift; { package Apache::OutputFilter; #XXX: make part of standard api? unless (defined &PRINT) { *PRINT = \&print; *TIEHANDLE = sub { shift }; } } tie *STDOUT, $filter; $Test::TESTOUT = \*STDOUT; $Test::planned = 0; $Test::ntest = 1; } sub handler { my $filter = shift; $filter->read(my $buffer); #slurp everything; init_test_pm($filter); plan tests => 6; ok $buffer eq $response_data; my $f = $filter->f; ok $f->isa('Apache::Filter'); my $frec = $f->frec; ok $frec->isa('Apache::FilterRec'); ok $frec->name; my $r = $f->r; ok $r->isa('Apache::RequestRec'); ok $r->uri eq '/' . __PACKAGE__; 0; } sub response { my $r = shift; $r->content_type('text/plain'); $r->puts($response_data); Apache::OK; } 1; __DATA__ SetHandler modperl PerlResponseHandler TestFilter::api::response 1.3 +2 -0 modperl-2.0/xs/Apache/Filter/Apache__Filter.h Index: Apache__Filter.h === RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Apache__Filter.h 2001/03/13 07:28:54 1.2 +++ Apache__Filter.h 2001/04/13 07:17:07 1.3 @@ -1,3 +1,5 @@ +#define mpxs_Apache__OutputFilter_f(filter) filter->f + #define mpxs_Apache__RequestRec_add_output_filter(r, name, ctx) \ ap_add_output_filter(name, ctx, r, NULL) 1.3 +3 -3 modperl-2.0/xs/maps/apache_structures.map Index: apache_structures.map === RCS file: /home/cvs/modperl-2.0/xs/maps/apache_structures.map,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apache_structures.map 2001/03/25 22:32:11 1.2 +++ apache_structures.map 2001/04/13 07:17:08 1.3 @@ -160,14 +160,14 @@ errmsg -! + name - filter_func - ftype +! ftype next -! + frec ctx next 1.2 +1 -0 modperl-2.0/xs/maps/modperl_functions.map Index: modperl_functions.map === RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- modperl_functions.map 2001/03/17 17:33:03 1.1 +++ modperl_functions.map 2001/04/13 07:17:08 1.2 @@ -22,3 +22,4 @@ MODULE=Apache::Filter PACKAGE=Apache::OutputFilter mpxs_Apache__OutputFilter_print | | ... mpxs_Apache__OutputFilter_read | | ... + ap_filter_t *:DEFINE_f | | modperl_filter_t *:filter
cvs commit: modperl-2.0/t/hooks/TestHooks trans.pm
dougm 01/04/12 19:05:58 Added: t/hooks trans.t t/hooks/TestHooks trans.pm Log: add test for PerlTransHandler Revision ChangesPath 1.1 modperl-2.0/t/hooks/trans.t Index: trans.t === use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestRequest; use Apache::Const ':common'; plan tests => 3, \&have_lwp; ok GET_RC('/nope') == NOT_FOUND; my $module = '/TestHooks/trans.pm'; my $body = GET_BODY $module; ok $body =~ /package TestHooks::trans/; ok GET_OK '/phooey'; 1.1 modperl-2.0/t/hooks/TestHooks/trans.pm Index: trans.pm === package TestHooks::trans; use strict; use warnings FATAL => 'all'; my %trans = ( '/TestHooks/trans.pm' => sub { my $r = shift; $r->filename(__FILE__); Apache::OK; }, '/phooey' => sub { shift->uri('/TestHooks::trans'); Apache::OK; }, ); sub handler { my $r = shift; my $handler = $trans{ $r->uri }; return Apache::DECLINED unless $handler; $handler->($r); } 1; __DATA__ PerlResponseHandler Apache::TestHandler::ok1 SetHandler modperl
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfigPerl.pm
dougm 01/04/12 19:04:52 Modified:Apache-Test/lib/Apache TestConfigPerl.pm Log: allow PerlTransHandler to be properly configured Revision ChangesPath 1.7 +13 -2 modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestConfigPerl.pm 2001/04/13 01:38:38 1.6 +++ TestConfigPerl.pm 2001/04/13 02:04:52 1.7 @@ -164,6 +164,7 @@ my %outside_container = map { $_, 1 } qw{ Alias AliasMatch AddType +PerlChildInitHandler PerlTransHandler PerlPostReadRequestHandler }; #test .pm's can have configuration after the __DATA__ token @@ -210,7 +211,8 @@ #@INC is auto-modified so each test .pm can be found #modules can add their own configuration using __DATA__ -my %hooks = map { $_, ucfirst $_ } qw(access authen authz type fixup log); +my %hooks = map { $_, ucfirst $_ } + qw(trans access authen authz type fixup log); $hooks{Protocol} = 'ProcessConnection'; $hooks{Filter} = 'OutputFilter'; @@ -250,8 +252,17 @@ } my $container = $container_config{$hook} || \&location_container; +my @handler_cfg = ($handler => $module); + +if ($outside_container{$handler}) { +$self->postamble(@handler_cfg); +} +else { +push @args, @handler_cfg; +} + $self->postamble($self->$container($module), - { $handler => $module, @args }); + { @args }) if @args; $self->write_pm_test($module, lc $base, lc $sub); }, $dir);
cvs commit: modperl-2.0/t/conf modperl_extra.pl
dougm 01/04/12 18:49:58 Modified:t/conf modperl_extra.pl Log: compile common constants at startup so we dont need to in each test module Revision ChangesPath 1.2 +2 -0 modperl-2.0/t/conf/modperl_extra.pl Index: modperl_extra.pl === RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- modperl_extra.pl 2001/04/02 09:10:18 1.1 +++ modperl_extra.pl 2001/04/13 01:49:58 1.2 @@ -4,4 +4,6 @@ use Apache::Server (); use Apache::Connection (); +use Apache::Const -compile => ':common'; + 1;
cvs commit: modperl-2.0/t/hooks/TestHooks fixup.pm
dougm 01/04/12 18:41:54 Added: t/hooks/TestHooks fixup.pm Log: add a test for PerlFixupHandler Revision ChangesPath 1.1 modperl-2.0/t/hooks/TestHooks/fixup.pm Index: fixup.pm === package TestHooks::fixup; use strict; use warnings FATAL => 'all'; use Apache::Test; sub handler { my $r = shift; $r->notes->set(ok => 1); Apache::OK; } sub response { my $r = shift; plan $r, tests => 1; ok $r->notes->get('ok'); Apache::OK; } 1; __DATA__ PerlResponseHandler TestHooks::fixup::response SetHandler modperl
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfigPerl.pm
dougm 01/04/12 18:38:38 Modified:Apache-Test/lib/Apache TestConfigPerl.pm Log: add a few to the hook config mapping table Revision ChangesPath 1.6 +1 -1 modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestConfigPerl.pm 2001/04/04 17:42:11 1.5 +++ TestConfigPerl.pm 2001/04/13 01:38:38 1.6 @@ -210,7 +210,7 @@ #@INC is auto-modified so each test .pm can be found #modules can add their own configuration using __DATA__ -my %hooks = map { $_, ucfirst $_ } qw(authen); +my %hooks = map { $_, ucfirst $_ } qw(access authen authz type fixup log); $hooks{Protocol} = 'ProcessConnection'; $hooks{Filter} = 'OutputFilter';
cvs commit: modperl-2.0/t/hooks/TestHooks access.pm
dougm 01/04/12 18:35:15 Added: t/hooks access.t t/hooks/TestHooks access.pm Log: add PerlAccessHandler test Revision ChangesPath 1.1 modperl-2.0/t/hooks/access.t Index: access.t === use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestRequest; plan tests => 4, \&have_lwp; my $location = "/TestHooks::access"; ok ! GET_OK $location; my $rc = GET_RC $location; ok $rc == 403; ok GET_OK $location, 'X-Forwarded-For' => '127.0.0.1'; ok ! GET_OK $location, 'X-Forwarded-For' => '666.0.0.1'; 1.1 modperl-2.0/t/hooks/TestHooks/access.pm Index: access.pm === package TestHooks::access; use strict; use warnings FATAL => 'all'; use APR::Table (); use Apache::Access (); use Apache::Const -compile => qw(OK FORBIDDEN); my $allowed_ips = qr{^(10|127)\.}; sub handler { my $r = shift; my $fake_ip = $r->headers_in->get('X-Forwarded-For') || ""; return Apache::FORBIDDEN unless $fake_ip =~ $allowed_ips; Apache::OK; } 1; __DATA__ PerlResponseHandler Apache::TestHandler::ok1 SetHandler modperl
cvs commit: modperl-2.0/t/hooks/TestHooks authz.pm
dougm 01/04/12 18:26:56 Added: t/hooks authz.t t/hooks/TestHooks authz.pm Log: add PerlAuthzHandler test Revision ChangesPath 1.1 modperl-2.0/t/hooks/authz.t Index: authz.t === use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestRequest; plan tests => 4, \&have_lwp; my $location = "/TestHooks::authz"; ok ! GET_OK $location; my $rc = GET_RC $location; ok $rc == 401; ok GET_OK $location, username => 'dougm', password => 'foo'; ok ! GET_OK $location, username => 'jobbob', password => 'whatever'; 1.1 modperl-2.0/t/hooks/TestHooks/authz.pm Index: authz.pm === package TestHooks::authz; use strict; use warnings FATAL => 'all'; use Apache::Access (); use Apache::Const -compile => qw(OK AUTH_REQUIRED); sub auth_any { my $r = shift; my($res, $sent_pw) = $r->get_basic_auth_pw; return $res if $res != Apache::OK; unless($r->user and $sent_pw) { $r->note_basic_auth_failure; return Apache::AUTH_REQUIRED; } return Apache::OK; } sub handler { my $r = shift; my $user = $r->user; return Apache::AUTH_REQUIRED unless $user; my($u, @allowed) = split /\s+/, $r->requires->[0]->{requirement}; return Apache::AUTH_REQUIRED unless grep { $_ eq $user } @allowed; Apache::OK; } 1; __DATA__ require user dougm AuthType Basic AuthName simple PerlAuthenHandler TestHooks::authz::auth_any PerlResponseHandler Apache::TestHandler::ok1 SetHandler modperl
cvs commit: modperl-2.0/t/response/TestAPR base64.pm
dougm 01/04/12 18:11:28 Added: t/response/TestAPR base64.pm Log: add test for APR::Base64 Revision ChangesPath 1.1 modperl-2.0/t/response/TestAPR/base64.pm Index: base64.pm === package TestAPR::base64; use strict; use warnings FATAL => 'all'; use Apache::Const -compile => 'OK'; use Apache::Test; use APR::Base64 (); sub handler { my $r = shift; plan $r, tests => 2; my $encoded = APR::Base64::encode("$r"); ok $encoded; my $decoded = APR::Base64::decode($encoded); ok $decoded eq "$r"; Apache::OK; } 1;
cvs commit: modperl-2.0/src/modules/perl modperl_callback.c
dougm 01/04/12 18:10:21 Modified:src/modules/perl modperl_callback.c Log: log rather than trace failure to resolve handler Revision ChangesPath 1.40 +3 -2 modperl-2.0/src/modules/perl/modperl_callback.c Index: modperl_callback.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- modperl_callback.c2001/04/12 03:49:42 1.39 +++ modperl_callback.c2001/04/13 01:10:20 1.40 @@ -36,8 +36,9 @@ (unsigned long)rp); if (!modperl_mgv_resolve(aTHX_ handler, rp, handler->name)) { -MP_TRACE_h(MP_FUNC, "failed to resolve handler `%s'\n", - handler->name); +ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "failed to resolve handler `%s'", + handler->name); return HTTP_INTERNAL_SERVER_ERROR; } }
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/12 17:51:54 Modified:Apache-Test/lib/Apache TestConfig.pm Log: forget a few things about the old config Revision ChangesPath 1.8 +2 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestConfig.pm 2001/04/13 00:47:38 1.7 +++ TestConfig.pm 2001/04/13 00:51:54 1.8 @@ -111,6 +111,8 @@ modules => {}, inc => [], %$thaw, +mpm => "", +httpd_defines => {}, vars => $args, postamble => [], preamble => [],
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/12 17:47:39 Modified:Apache-Test/lib/Apache TestConfig.pm Log: add config for perchild mpm Revision ChangesPath 1.7 +9 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestConfig.pm 2001/04/12 03:23:58 1.6 +++ TestConfig.pm 2001/04/13 00:47:38 1.7 @@ -691,6 +691,15 @@ MaxRequestsPerChild 0 + +NumServers 1 +StartThreads 1 +MinSpareThreads 1 +MaxSpareThreads 1 +MaxThreadsPerChild 2 +MaxRequestsPerChild 0 + + StartServers 1 MaxClients 1
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfigParse.pm TestServer.pm
dougm 01/04/12 17:28:47 Modified:Apache-Test/lib/Apache TestConfigParse.pm TestServer.pm Log: include mpm name with server version report Revision ChangesPath 1.2 +4 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfigParse.pm Index: TestConfigParse.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigParse.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestConfigParse.pm2001/04/02 08:57:07 1.1 +++ TestConfigParse.pm2001/04/13 00:28:46 1.2 @@ -200,6 +200,10 @@ } close $proc; + +if (my $mpm_dir = $self->{httpd_defines}->{APACHE_MPM_DIR}) { +$self->{mpm} = basename $mpm_dir; +} } sub httpd_version { 1.5 +6 -2 modperl-2.0/Apache-Test/lib/Apache/TestServer.pm Index: TestServer.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestServer.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestServer.pm 2001/04/10 16:48:49 1.4 +++ TestServer.pm 2001/04/13 00:28:46 1.5 @@ -247,6 +247,11 @@ sleep 1; } +my $version = $self->{version}; +my $mpm = $self->{config}->{mpm} || ""; +$mpm = "($mpm MPM)" if $mpm; +print "using $version $mpm\n"; + my $tries = 6; for (1..$tries) { @@ -273,8 +278,7 @@ } if (my $pid = $self->pid) { -my $version = $self->{version}; -print "server $self->{name} started (pid=$pid, version=$version)\n"; +print "server $self->{name} started (pid=$pid)\n"; while (my($module, $cfg) = each %{ $self->{config}->{vhosts} }) { print "server $cfg->{name} listening ($module)\n", }
cvs commit: modperl-2.0/src/modules/perl mod_perl.c
dougm 01/04/12 09:15:21 Modified:src/modules/perl mod_perl.c Log: duh: need to snag @DynaLoader::dl_librefs before they are wiped out by perl_destruct() Revision ChangesPath 1.47 +3 -1 modperl-2.0/src/modules/perl/mod_perl.c Index: mod_perl.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- mod_perl.c2001/04/12 03:24:45 1.46 +++ mod_perl.c2001/04/12 16:15:19 1.47 @@ -7,6 +7,8 @@ PerlInterpreter *perl = (PerlInterpreter *)cdata->data; apr_array_header_t *handles; +handles = modperl_xs_dl_handles_get(cdata->pool); + PL_perl_destruct_level = 2; MP_TRACE_i(MP_FUNC, "destroying interpreter=0x%lx\n", (unsigned long)perl); @@ -14,7 +16,7 @@ perl_destruct(perl); perl_free(perl); -if ((handles = modperl_xs_dl_handles_get(cdata->pool))) { +if (handles) { modperl_xs_dl_handles_close(handles); }
cvs commit: modperl-2.0 Makefile.PL
dougm 01/04/12 09:03:55 Modified:.Makefile.PL Log: make sure test files a cleaned Revision ChangesPath 1.33 +1 -0 modperl-2.0/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl-2.0/Makefile.PL,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- Makefile.PL 2001/04/11 23:00:56 1.32 +++ Makefile.PL 2001/04/12 16:03:55 1.33 @@ -234,6 +234,7 @@ my $self = shift; my $string = $self->MM::clean(@_); ModPerl::MM::add_dep(\$string, clean => 'modperl_src_clean'); +ModPerl::MM::add_dep(\$string, clean => 'test_clean'); $string; }