Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Disabling a C Apache handler with mod_perl

by Mutant (Priest)
on May 17, 2007 at 16:18 UTC ( [id://616043]=perlquestion: print w/replies, xml ) Need Help??

Mutant has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have an Apache 1.3 setup where a C module does some stuff during the HeaderParser phase. I'd like to conditionally disable this.

My first thought was to write a mod_perl handler for the HeaderParser phase, that runs before the C handler, and if it should be disabled, returns 'OK' from the handler, meaning no other handlers execute during this phase. However, it seems this only works in certain phases, not including HeaderParser (all registered handlers get executed, regardless of what they return).

Is there anyway I can prevent the C handler from running?

After my handler has disabled the C handler, I need Apache to run the rest of the request process as per normal (including any other custom handlers that may be defined). I can't modify the C handler (it's 3rd party code).

Thanks in advance.
  • Comment on Disabling a C Apache handler with mod_perl

Replies are listed 'Best First'.
Re: Disabling a C Apache handler with mod_perl
by perrin (Chancellor) on May 17, 2007 at 17:38 UTC
    Try this:
    $r->set_handlers( PerlHeaderParserHandler => [ \&OK ] );
    There's some discussion of it in the docs. If that doesn't work, you can try manipulating the configuration from mod_perl on the fly, i.e. only add the C handler for that phase when you want it, from a perl handler that runs earlier.
      Thanks...

      I don't think set_handlers() (and similar methods) will work here, because they only appear to deal with mod_perl handlers, not C handlers.

      How do I go about modifying the Apache config on the fly? AFAICT, the methods relating to config in the Apache object are read-only.
        You can set C handlers. For example, this tells apache to use the standard file handler:
        $r->handler('default-handler');

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://616043]
Approved by kyle
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-04-24 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found