httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amlaan Kar <amlaan....@gmail.com>
Subject Re: [users@httpd] Use an Apache handler after declining another
Date Tue, 19 Jul 2016 12:42:04 GMT
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
(DECLINED);
    ap_set_content_type(r, "text/html");
    ap_rprintf(r, "Hello, world!");
    return OK;
}

static void register_hooks(apr_pool_t *pool)
{
    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

AP_DECLARE_MODULE(example1) =
{
    STANDARD20_MODULE_STUFF,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    register_hooks
};

Their configuration directives are as given below:
<Location "/example1">
    SetHandler example1-handler
</Location>

<Location "/products.php">
    SetHandler example5-handler
</Location>

On Tue, Jul 19, 2016 at 6:01 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:

> On Tue, Jul 19, 2016 at 2:15 PM, Amlaan Kar <amlaan.kar@gmail.com> wrote:
> > static void register_hooks(apr_pool_t *pool)
> > {
> >     static const char *const succs[] = {"mod_example1.c", NULL };
> >     ap_hook_handler(example5_handler, NULL, succs, APR_HOOK_FIRST);
> > }
> > AP_DECLARE_MODULE(example5) =
> > {
> >     STANDARD20_MODULE_STUFF,
> >     NULL,
> >     NULL,
> >     NULL,
> >     NULL,
> >     NULL,
> >     register_hooks};
> >
> >
> > Sorry, I can't share the remaining code. I hope you can help me with
> this.
>
> OK, so example5_handler() runs and returns DECLINED, but
> example1_handler() does not run at all?
>
> How is example1_handler hooked, which handler is taking the request?
> Any special configuration in httpd.conf (*Handler) for these modules?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Mime
View raw message