You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dirk-Willem van Gulik <di...@covalent.net> on 2001/10/12 20:17:03 UTC

Portign 1.3 modules - should I still use handlers ?

While porting a 1.3 module to 2.0 - which is totally handler based; I
used to have:

	static const handler_rec s99_handlers[] = {
	    {"s99hk", s99_hk_handler},
	    {"s99get", s99_get_handler},
	    {"s99cadget", s99_cadget_handler},
	    .....<lots and lots more of those>.....
	    {NULL, NULL}
	};

and now in 2.0 I am doing:

	static void register_hooks(apr_pool_t *p)
	{
	    ap_hook_handler(s99_hk_handler, NULL, NULL, APR_HOOK_MIDDLE);
	    ap_hook_handler(s99_get_handler, NULL, NULL, APR_HOOK_MIDDLE);
	    ....

	static int s99_hk_handler(...)
	{
	    struct s99_module_data * m = ap_get_module..
	    .....
	    if (strcmp(r->handler, "s99hk"))
        	return DECLINED;

	static int s99_get_handler(...)
	{
	    struct s99_module_data * m = ap_get_module..
	    .....
	    if (strcmp(r->handler, "s99get"))
        	return DECLINED;

Now is this the right thing to do ? i.e. have apache go into each of the
handlers and ask it wether it wants to run or decline.

Or is there a way I can keep this deceision process closer to the core in
some tight inner loop ?

Or to ask the question in other words - are handlers still the right thing
to use for this sort of 'fan out' handling or is there another technique
more optimal in 2.0 ?

Dw