perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Moyer <f...@taperfriendlymusic.org>
Subject Stacked handlers bug unit test
Date Thu, 15 Nov 2007 17:19:53 GMT
Hi Phillipe :)

Here is the unit test I was telling you about for the bug I found where 
pushing handlers onto a different phase of the request cycle causes the 
push to act as a set_handler instead.  I dug into the guts of 
modperl_handler.c looking for what is causing this but I'm still green 
in dealing with the mod_perl internals.

I'll track you down later and demonstrate this issue.

- Fred

Index: t/hooks/TestHooks/stacked_handlers2.pm
===================================================================
--- t/hooks/TestHooks/stacked_handlers2.pm      (revision 584452)
+++ t/hooks/TestHooks/stacked_handlers2.pm      (working copy)
@@ -45,6 +45,17 @@
      return Apache2::Const::SERVER_ERROR;
  }

+sub push_fixup_handler {
+
+    my $r = shift;
+
+    $r->push_handlers(PerlFixupHandler => \&ok);
+
+    callback($r);
+
+    return Apache2::Const::OK;
+}
+
  sub push_handlers {

      my $r = shift;
@@ -150,7 +161,8 @@

      PerlModule TestHooks::stacked_handlers2

-    # all 2 run
+    # all 3 run
+    PerlPostReadRequestHandler 
TestHooks::stacked_handlers2::push_fixup_handler
      PerlPostReadRequestHandler TestHooks::stacked_handlers2::ok 
TestHooks::stacked_handlers2::ok

      # 1 run, 1 left behind

Index: t/hooks/stacked_handlers2.t
===================================================================
--- t/hooks/stacked_handlers2.t (revision 584452)
+++ t/hooks/stacked_handlers2.t (working copy)
@@ -18,7 +18,7 @@

  plan tests => 1;

-my $expected = q!ran 2 PerlPostReadRequestHandler handlers
+my $expected = q!ran 3 PerlPostReadRequestHandler handlers
  ran 1 PerlTransHandler handlers
  ran 1 PerlMapToStorageHandler handlers
  ran 4 PerlHeaderParserHandler handlers
@@ -26,7 +26,7 @@
  ran 2 PerlAuthenHandler handlers
  ran 2 PerlAuthzHandler handlers
  ran 1 PerlTypeHandler handlers
-ran 4 PerlFixupHandler handlers
+ran 3 PerlFixupHandler handlers
  ran 2 PerlResponseHandler handlers
  ran 2 PerlOutputFilterHandler handlers!;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message