You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by luca regini <lu...@gmail.com> on 2005/06/27 11:47:24 UTC

How can shared modules parse the configuration tree(ap_conftree)???

I see that the symbols ap_conftree and ap_top_module are not defined in any 
header but only in the source code. Mod_info uses this symbols. 
I need to do something similar to what mod_info does but in a shared module. 
Is there a way to do it?? The fact that ap_conftree and ap_top_module are 
not defined in any header does mean that the API is not stable and probably 
will change???
 I need to parse the configuration tree because i would like to chance 
programmatically the value of a cookie in an input filter. However the right 
value for the cookie is directory - dependent and per directory 
configuration is not available in an input filter. So my idea whas to desume 
the right value parsing the per directory directives i was interested in at 
module startup.
 I would like anyway to do this in a shared module, because i would'nt like 
to distribute a different version of Apache.
 I have been digging very deeply in Apache source code and i am pretty 
clueless now.
Thanks in advance for your attention.
Luca Regini

Re: How can shared modules parse the configuration tree(ap_conftree)???

Posted by Rici Lake <ri...@ricilake.net>.
On 27-Jun-05, at 4:47 AM, luca regini wrote:

> I see that the symbols ap_conftree and ap_top_module are not defined 
> in any header but only in the source code. Mod_info uses this symbols.
> I need to do something similar to what mod_info does but in a shared 
> module. Is there a way to do it?? The fact that ap_conftree and 
> ap_top_module are not defined in any header does mean that the API is 
> not stable and probably will change???
>  
> I need to parse the configuration tree because i would like to chance 
> programmatically the value of a cookie in an input filter. However the 
> right value for the cookie is directory - dependent  and per directory 
> configuration is not available in an input filter. So my idea whas to 
> desume the right value parsing the per directory directives i was 
> interested in at module startup.

That's a really bad idea. The fact that it is difficult should be a 
good hint that it is contrary to the design of Apache.

I gather the problem you're running into is that the headers are read 
before the configuration merge is done (for reasons I think are pretty 
obvious). However, cookies are certainly not used until the 
configuration merge is done. So why not do whatever you want to do with 
the cookies in a hook which runs at an appropriate time? There are lots 
to choose from. The input filter could put whatever information it 
wanted to pass to the hook in the module's per-request structure.