httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: [Patch]: Implement hook/hash extensions for mod_include handlers
Date Thu, 07 Dec 2000 01:10:37 GMT

In modifying this patch to not use a hook, but just publish a function, I
have noticed some problems.  I am fixing all of these, but I want to
explain them here, so that there are not surprises.


> +/*
> +**  Per-Child Module Initialization. This must run REALLY last
> +**    so that all of the other modules/filters will have had a
> +**    chance to run ap_hook_ssi_handler_register() and run their
> +**    own init processing before this is called.
> +**  [called after a child process is spawned]
> +*/
> +static void init_include_hash(apr_pool_t *p, server_rec *s)
> +{
> +    /* setup and initialize the hash table. */
> +    hash_table = apr_make_hash(p);
> +
> +    /* Run the hash table initialization hook. */
> +    ap_run_ssi_handler_register(hash_table);
> +}

This shouldn't be done in the child_init phase.  If we do it there, then
every child has to re-populate the hash table when it is
started.  Populating the hash table should be done in the parent process,
so that child processes get it for free.

>  static void register_hooks(void)
>  {
> +    ap_hook_post_config(register_ssi_handlers,NULL,NULL,AP_HOOK_MIDDLE);
> +    ap_hook_child_init(init_include_hash,NULL,NULL,AP_HOOK_LAST+1);

If you want a hook to run absolutely first or absolutely last, just use
AP_HOOK_REALLY_FIRST and AP_HOOK_REALLY_LAST.  Those two values are almost
never used, because you have to feel VERY strong about being first or last
to use them, so they are safe.

Ryan
_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------



Mime
View raw message