You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Glenn Nielsen <gl...@mail.more.net> on 2004/02/25 17:28:42 UTC
Apache 2 module hook priorities, was: Help required on Apache from scratch...
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.
Regards,
Glenn
----------------------------------------------------------------------
Glenn Nielsen glenn@more.net | /* Spelin donut madder |
MOREnet System Programming | * if iz ina coment. |
Missouri Research and Education Network | */ |
----------------------------------------------------------------------
Re: Apache 2 module hook priorities, was: Help required on Apache
from scratch...
Posted by Henri Gomez <hg...@apache.org>.
Glenn Nielsen wrote:
> 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 ...
Re: Apache 2 module hook priorities, was: Help required on Apache from scratch...
Posted by Glenn Nielsen <gl...@mail.more.net>.
Henri,
Perhaps we should bounce these last two messages to tomcat-dev
and continue the discussion there.
Resolving this problem will require a great deal of painstaking
work. Setting up test conditions to test mod_jk 1.2/2 interaction
with other core apache modules and commonly used ones like mod_dav.
Once all the test conditions are setup then we will have to review
the hook priority for these modules and try to determine the best
hook settings for mod_jk or where we need to add code to handle exceptions
in mod_jk. Then test again until all of our test conditions pass.
Regards,
Glenn
On Wed, Feb 25, 2004 at 06:12:23PM +0100, Henri Gomez wrote:
>
> >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.
>
> It seems we should add more code in jk2_map_to_storage(...)
>
> Here's what you put in jk....
>
>
> Correct ?
>
> if(!r->proxyreq && !apr_table_get(r->notes, JK_WORKER_ID)) {
> jk_server_conf_t *conf =
> (jk_server_conf_t
> *)ap_get_module_config(r->server->module_config,
> &jk_module);
>
> if(conf) {
> char *worker;
> if( (r->handler != NULL ) &&
> (! strcmp( r->handler, JK_HANDLER ) )) {
> /* Somebody already set the handler, probably manual
> config
> * or "native" configuration, no need for extra
> overhead
> */
> jk_log(conf->log, JK_LOG_DEBUG,
> "Manually mapped, no need to call
> uri_to_worker\n");
> return DECLINED;
> }
> worker = map_uri_to_worker(conf->uw_map, r->uri,
> conf->log);
>
> if(worker) {
> r->handler=apr_pstrdup(r->pool,JK_HANDLER);
> apr_table_setn(r->notes, JK_WORKER_ID, worker);
>
> /* This could be a sub-request, possibly from
> mod_dir */
> if(r->main)
> apr_table_setn(r->main->notes, JK_WORKER_ID,
> worker);
>
> }
> }
> }
----------------------------------------------------------------------
Glenn Nielsen glenn@more.net | /* Spelin donut madder |
MOREnet System Programming | * if iz ina coment. |
Missouri Research and Education Network | */ |
----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
Re: Apache 2 module hook priorities, was: Help required on Apache from scratch...
Posted by Glenn Nielsen <gl...@mail.more.net>.
Henri,
Perhaps we should bounce these last two messages to tomcat-dev
and continue the discussion there.
Resolving this problem will require a great deal of painstaking
work. Setting up test conditions to test mod_jk 1.2/2 interaction
with other core apache modules and commonly used ones like mod_dav.
Once all the test conditions are setup then we will have to review
the hook priority for these modules and try to determine the best
hook settings for mod_jk or where we need to add code to handle exceptions
in mod_jk. Then test again until all of our test conditions pass.
Regards,
Glenn
On Wed, Feb 25, 2004 at 06:12:23PM +0100, Henri Gomez wrote:
>
> >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.
>
> It seems we should add more code in jk2_map_to_storage(...)
>
> Here's what you put in jk....
>
>
> Correct ?
>
> if(!r->proxyreq && !apr_table_get(r->notes, JK_WORKER_ID)) {
> jk_server_conf_t *conf =
> (jk_server_conf_t
> *)ap_get_module_config(r->server->module_config,
> &jk_module);
>
> if(conf) {
> char *worker;
> if( (r->handler != NULL ) &&
> (! strcmp( r->handler, JK_HANDLER ) )) {
> /* Somebody already set the handler, probably manual
> config
> * or "native" configuration, no need for extra
> overhead
> */
> jk_log(conf->log, JK_LOG_DEBUG,
> "Manually mapped, no need to call
> uri_to_worker\n");
> return DECLINED;
> }
> worker = map_uri_to_worker(conf->uw_map, r->uri,
> conf->log);
>
> if(worker) {
> r->handler=apr_pstrdup(r->pool,JK_HANDLER);
> apr_table_setn(r->notes, JK_WORKER_ID, worker);
>
> /* This could be a sub-request, possibly from
> mod_dir */
> if(r->main)
> apr_table_setn(r->main->notes, JK_WORKER_ID,
> worker);
>
> }
> }
> }
----------------------------------------------------------------------
Glenn Nielsen glenn@more.net | /* Spelin donut madder |
MOREnet System Programming | * if iz ina coment. |
Missouri Research and Education Network | */ |
----------------------------------------------------------------------
Re: Apache 2 module hook priorities, was: Help required on Apache
from scratch...
Posted by Henri Gomez <hg...@apache.org>.
> 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.
It seems we should add more code in jk2_map_to_storage(...)
Here's what you put in jk....
Correct ?
if(!r->proxyreq && !apr_table_get(r->notes, JK_WORKER_ID)) {
jk_server_conf_t *conf =
(jk_server_conf_t
*)ap_get_module_config(r->server->module_config,
&jk_module);
if(conf) {
char *worker;
if( (r->handler != NULL ) &&
(! strcmp( r->handler, JK_HANDLER ) )) {
/* Somebody already set the handler, probably manual
config
* or "native" configuration, no need for extra
overhead
*/
jk_log(conf->log, JK_LOG_DEBUG,
"Manually mapped, no need to call
uri_to_worker\n");
return DECLINED;
}
worker = map_uri_to_worker(conf->uw_map, r->uri,
conf->log);
if(worker) {
r->handler=apr_pstrdup(r->pool,JK_HANDLER);
apr_table_setn(r->notes, JK_WORKER_ID, worker);
/* This could be a sub-request, possibly from
mod_dir */
if(r->main)
apr_table_setn(r->main->notes, JK_WORKER_ID,
worker);
}
}
}