httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <>
Subject Re: [users@httpd] Use an Apache handler after declining another
Date Tue, 19 Jul 2016 14:21:21 GMT
On Tue, Jul 19, 2016 at 2:42 PM, Amlaan Kar <> wrote:
> example1_handler is as given below:
> module AP_MODULE_DECLARE_DATA example1_module;
> static int example1_handler(request_rec *r)
> {
>     if (!r->handler || strcmp(r->handler, "example1-handler")) return

So it does nothing unless "SetHandler example1-handler" above is effective.

>     ap_set_content_type(r, "text/html");
>     ap_rprintf(r, "Hello, world!");
>     return OK;
> }
> Their configuration directives are as given below:
> <Location "/example1">
>     SetHandler example1-handler
> </Location>
> <Location "/products.php">
>     SetHandler example5-handler
> </Location>

If you request "/products.php", the handler is set to
"example5-handler", and example1_handler() DECLINEs.

I can't tell about your goal, but if it is to code the first example5
like module only, it probably shouldn't rely on a SetHandler to run
(i.e. the value of r->handler), such that other SetHandler(s)
needed/set by/for other modules could be preserved (not mangled for
the need of your module).

If for example the goal is to activate your module on some specific
locations, those locations could be configured by a directive specific
to your module, like:

  MyModuleEnable "/products.php"

(either a string prefix, repeated as many times as needed, a regexp, whatever).

There are other ways to do this (by setting an environment variable
with for example SetEnvIf, and checking it in your handler), in any
case a DECLINing handler should not have to deal with r->handler
unless it knows which handler to force next.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message