You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Will Hartung <wi...@msoft.com> on 2002/09/26 00:24:32 UTC

Multiple handlers within a module?

I'm porting a 1.3 module to 2.0. In our 1.3 module, we have this kind of
structure:

static const handler_rec our_handlers[] =
{
    {   "ourthis", HandleThis  },
    {   "ourthat", HandleThat    },
    {   "ourother", HandleOther      },
    {   NULL                                    }
};

It is not at all clear to me using the new 2.0 modules how I associate the
different names to our module. I see the ap_hook_handler(), but it only
wants the function, and doesn't seem to have a way of binding a name to that
function.

I also noticed within the mod_example, that they check the actual handler
name when the function is called. Is that necessary? Is that the actual
mechanism?

Any help would be appreciated.

(If this is the wrong list for this, then a pointer to the correct one would
also be appreciated.)

Will Hartung
(willh@msoft.com)




Re: Multiple handlers within a module?

Posted by Jeff Trawick <tr...@attglobal.net>.
Justin Erenkrantz <je...@apache.org> writes:

> On Wed, Sep 25, 2002 at 03:24:32PM -0700, Will Hartung wrote:
> > It is not at all clear to me using the new 2.0 modules how I associate the
> > different names to our module. I see the ap_hook_handler(), but it only
> > wants the function, and doesn't seem to have a way of binding a name to that
> > function.
> 
> It doesn't.  All handlers are invoked on all requests.  So, there is
> no relationship between the invocation of a handler and whether it
> needs to run.  The handler must check whether its handler string is
> the same as r->handler.  If not, it is expected to return DECLINED.
> 
> > I also noticed within the mod_example, that they check the actual handler
> > name when the function is called. Is that necessary? Is that the actual
> > mechanism?
> 
> Yes.  -- justin

This thread is definitely a FAQ. Anybody up to sticking it here?

  http://httpd.apache.org/docs-2.0/developer/modules.html

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: Multiple handlers within a module?

Posted by Justin Erenkrantz <je...@apache.org>.
On Wed, Sep 25, 2002 at 03:24:32PM -0700, Will Hartung wrote:
> It is not at all clear to me using the new 2.0 modules how I associate the
> different names to our module. I see the ap_hook_handler(), but it only
> wants the function, and doesn't seem to have a way of binding a name to that
> function.

It doesn't.  All handlers are invoked on all requests.  So, there is
no relationship between the invocation of a handler and whether it
needs to run.  The handler must check whether its handler string is
the same as r->handler.  If not, it is expected to return DECLINED.

> I also noticed within the mod_example, that they check the actual handler
> name when the function is called. Is that necessary? Is that the actual
> mechanism?

Yes.  -- justin