Author: pgollucci Date: Fri Aug 25 23:06:45 2006 New Revision: 437092 URL: http://svn.apache.org/viewvc?rev=437092&view=rev Log: $r->Apache2::RequestUtil::get_handlers() segfaults with anonymous subs.
This however is a mod_perl 2.x issue not Apache::SizeLimit, so we code around it for now. Thread: <[EMAIL PROTECTED]> Verified by: geoff Modified: perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm Modified: perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm?rev=437092&r1=437091&r2=437092&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm (original) +++ perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm Fri Aug 25 23:06:45 2006 @@ -18,6 +18,8 @@ use strict; use Config; +use APR::Pool (); + use Apache2::RequestUtil (); use Apache2::MPM (); use Apache2::Const -compile => qw (DECLINED OK); @@ -71,10 +73,8 @@ # test it, since apparently it does not push a handler onto the # PerlCleanupHandler phase. That means that there's no way to use # $r->get_handlers() to check the results of calling this method. - $r->push_handlers( - 'PerlCleanupHandler', - sub { $class->_exit_if_too_big(shift) } - ); + # $r->get_handlers() SEGFAULTS at the moment in 2.x + $r->pool->cleanup_register(\&exit_if_too_big, $r); $r->pnotes(size_limit_cleanup => 1); } Modified: perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm?rev=437092&r1=437091&r2=437092&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm (original) +++ perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm Fri Aug 25 23:06:45 2006 @@ -15,7 +15,7 @@ sub handler { my $r = shift; - plan $r, tests => 12; + plan $r, tests => 9; ok( ! Apache2::SizeLimit->_limits_are_exceeded(), 'check that _limits_are_exceeded() returns false without any limits set' ); @@ -74,28 +74,6 @@ Apache2::SizeLimit->set_check_interval(10); is( $Apache2::SizeLimit::CHECK_EVERY_N_REQUESTS, 10, 'set_check_interval set global' ); - } - - { - Apache2::SizeLimit->set_max_process_size(0); - Apache2::SizeLimit->set_min_shared_size(0); - Apache2::SizeLimit->set_max_unshared_size(0); - - my $handlers = $r->get_handlers('PerlCleanupHandler'); - is( scalar @$handlers, 0, - 'there is no PerlCleanupHandler before add_cleanup_handler()' ); - - Apache2::SizeLimit->add_cleanup_handler($r); - - $handlers = $r->get_handlers('PerlCleanupHandler'); - is( scalar @$handlers, 1, - 'there is one PerlCleanupHandler after add_cleanup_handler()' ); - - Apache2::SizeLimit->add_cleanup_handler($r); - - $handlers = $r->get_handlers('PerlCleanupHandler'); - is( scalar @$handlers, 1, - 'there is stil one PerlCleanupHandler after add_cleanup_handler() a second time' ); } return Apache2::Const::OK;