On Wed, Feb 25, 2004 at 04:40:32PM +0100, Henri Gomez wrote:
Bill Stoddard wrote:
Benedict DSilva wrote:
Hi all,
Just wanted to know about how does the Apache HTTP Server start, and all that it does with the modules (Initialization, Configuration etc).
Explaining how Apache HTTPD works to the degree of detail you are looking for is a rather tall request to answer in an email. My suggestion is to pick up a copy of Ryan Bloom's Complete Reference to Apache 2.0 then read the code.
Did there is a book for modules writers ?
I'm working on jk2 connector (mod_jk2) and looking for some nasty problem (mostly conflict between jk2 and others modules).
Help welcomed ...
Henri,
Getting the priority set correctly for hooks in JK2 is sticky.
You might take a look at what I did setting hook priority in
mod_jk 1.2 so that it would work correctly with mod_dir. My
cvs commit messages might be helpful from jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c .
Here is the page the docs how hook priority works:
http://httpd.apache.org/docs-2.0/developer/hooks.html
It all comes down to carefully reviewing the hook priority of other modules and how those modules interact with JK2. Then setting the hook priorities in JK2.
Well I read jk 1.2.x and 2.0.x and see no differences :
jk :
static void jk_register_hooks(apr_pool_t *p)
{
ap_hook_handler(jk_handler,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_post_config(jk_post_config,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_child_init(jk_child_init,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_translate_name(jk_translate,NULL,NULL,APR_HOOK_MIDDLE);
#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
ap_hook_map_to_storage(jk_map_to_storage,NULL,NULL,APR_HOOK_MIDDLE);
#endif
}jk2 :
static void jk2_register_hooks(apr_pool_t *p)
{
ap_hook_handler(jk2_handler, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_config(jk2_post_config,NULL,NULL,APR_HOOK_MIDDLE);
/* Force the mpm to run before us and set the scoreboard image */
ap_hook_child_init(jk2_child_init,NULL,NULL,APR_HOOK_LAST);
ap_hook_translate_name(jk2_translate,NULL,NULL,APR_HOOK_FIRST); /* use APR_HOOK_MIDDLE instead ? */
ap_hook_map_to_storage(jk2_map_to_storage, NULL, NULL, APR_HOOK_MIDDLE);
}
The registering is very similar to me ...
I see in CVS that sometime in the past there was in jk :
static void jk_register_hooks(apr_pool_t *p)
{ {
ap_hook_handler(jk_handler, NULL, NULL, APR_HOOK_MIDDLE); /* Make sure mod_alias runs before mod_jk to make sure that
Alias's are mapped before mod_jk tries to process the request */
static const char * const aszPre[] = { "mod_alias.c", NULL };
/* Make sure mod_dir runs after mod_jk so that a
DirectoryIndex index.jsp works */
static const char * const aszPost[] = { "mod_dir.c", NULL };ap_hook_handler(jk_handler,aszPre,aszPost,APR_HOOK_MIDDLE);
ap_hook_post_config(jk_post_config,NULL,NULL,APR_HOOK_MIDDLE); ap_hook_post_config(jk_post_config,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_child_init(jk_child_init,NULL,NULL,APR_HOOK_MIDDLE); ap_hook_child_init(jk_child_init,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_translate_name(jk_translate,NULL,NULL,APR_HOOK_FIRST); ap_hook_translate_name(jk_translate,aszPre,aszPost,APR_HOOK_MIDDLE);
#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808) #if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
ap_hook_map_to_storage(jk_map_to_storage, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_map_to_storage(jk_map_to_storage,aszPre,aszPost,APR_HOOK_MIDDLE);
#endif #endif
} }
Need advices here ...
