Jeremy Nixon wrote:
> Fred Moyer  <[EMAIL PROTECTED]> wrote:
> 
>> But... once I changed my return codes to allow the other handlers to
>> return DECLINED instead of OK in a couple of particular situations,
>> push_handlers() behaved as I would have expected it to.  I'm guessing
>> that your PerlFixupHandler is set to return OK instead of DECLINED
>> somewhere (or maybe not, PerlFixupHandler is RUN_ALL last time I checked).
> 
> Yes, I was returning OK, but since the phases are RUN_ALL I didn't think
> that would matter.  And, when I register multiple handlers all the same
> way, either all in httpd.conf or all with push_handlers, they all run,
> even returning OK.

So I have been playing with different combinations of push_handlers()
and it looks like it's working properly for RUN_FIRST handlers (my
initial success with using DECLINED instead of OK) but not RUN_ALL
handlers. Here's the test case, run make test and check the log to see
which handlers ran.  Anyone?

------------------------

t/conf/extra/conf.in

PerlPostReadRequestHandler My::TestHandler
<Location /test>
   SetHandler modperl
   PerlFixupHandler My::ResponseHandler
   PerlResponseHandler Apache2::Const::OK
</Location>

-----------

t/01.t

#!perl

use strict;

use Apache::Test;
use Apache::TestRequest;

plan tests => 1;

my $res = GET_OK '/test';

----------------

package My::TestHandler;

use strict;
use warnings;

use Apache2::RequestUtil;
use Apache2::Const -compile => qw(OK);
use Apache2::Log;

sub handler {
        my $r = shift;
        $r->log->error(__PACKAGE__ . " handling request $$");
        $r->push_handlers(PerlFixupHandler=> 'My::ExtraResponse');
        #$r->push_handlers(PerlResponseHandler => 'My::ExtraResponse');
        return Apache2::Const::OK;
}
1;

------------------

package My::ResponseHandler;

use strict;
use warnings;

use Apache2::Const -compile => qw(OK DECLINED);
use Apache2::RequestIO;
use Apache2::Log;

sub handler {
        my $r = shift;
        $r->log->error(__PACKAGE__ . " handling request $$");
        return Apache2::Const::DECLINED;
}

1;

-----------------

package My::ExtraResponse;

use strict;
use warnings;

use Apache2::Const -compile => qw(OK DECLINED);
use Apache2::RequestIO;
use Apache2::Log;

sub handler {
        my $r = shift;
        $r->log->error(__PACKAGE__ . " handling request $$");
        return Apache2::Const::OK;
}

1;

Reply via email to