perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject setHandler question
Date Fri, 14 Dec 2012 13:52:28 GMT
Hi.

Quite a while ago (2008), this discussion on the list :

http://marc.info/?l=apache-modperl&m=122399752819709&w=2

was about how to, within a PerlAuthenHandler, override the ResponseHandler which would 
normally kick in later in the cycle, and force it to be mod_perl and a specific (other) 
PerlresponseHandler.

The general idea is like :

if (some_condition) {

    $r->handler('modperl');
    $r->set_handlers(PerlResponseHandler => \&_my_response_handler);
}

or even :

$r->set_handlers(PerlResponseHandler => \&_my_response_handler);
$r->set_handlers(PerlFixupHandler => sub { $_[0]->handler('modperl') } );

and generally speaking it works.
Only, sometimes it doesn't, and Apache proceeds to use the previously-configured response

handler no matter what.

Then there was a hint that, in addition to the above, one might need to also set or clear

something in the $r->finfo structure, to (as I, with my limited knowledge understand it)

tell Apache that we really know what we are doing, and really want to override what it 
already knows about the final destination.

This "thing" to set in the $r->finfo() being Apache2::Const::OR_FILEINFO or thereabouts.

And an example was even given in the thread, as :

   $r->add_config(['SetHandler ...'], Apache2::Const::OR_FILEINFO)

Only, here I have already set the Handler, and I would merely want to try just to set the

above flag.
So how would I do that ?

I do not see a way to pass this argument in $r->handler().
I see in the doc this : http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_finfo_

but I do not really understand the example given.

I suppose that in the end I will want to do something like this :

my $finfo = $r->finfo();
# do something to $finfo to set the flag
$r->finfo($finfo);
$r->handler('modperl');
$r->set_handlers(PerlResponseHandler => \&_my_response_handler);

but how do I "do something to $finfo" ?

Or am I totally off-track here ?

TIA

Mime
View raw message