httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Bloom" <>
Subject RE: help with apache configuration "logic"...
Date Sun, 02 Jun 2002 22:28:09 GMT

> I'm in the process of porting to apache 2 a module I developped for
> apache 1.3. The 'mod_macro' module add macro definition capabilities
> to apache configuration files. Macros are expanded on the fly and
> With apache 1.3, I needed an initialization phase each time a new
> configuration cycle is started, as there are two analyses of the
> configuration file each time apache is launched. The hack I found was
> notice that the temporary pool has changed to re-initialized my
> data structures which holds the description of macros... quite poor.
> Now with apache 2, I digged out in the source code a 'pre_config' and
> 'post_config' hook that look just fine, so I was planing to use that
> instead of the previous hack. However :
> 1/ the apache configuration is still read twice.
>    well, why not if it pleases you.
> 2/ the pre_config hook is run *AFTER* the configuration file
>    is read. Indeed, you can see that in main.c where
>    ap_run_pre_config() is called after ap_read_config()

Yes, but it is read before the file is actually processed.  There is
VERY little done when the configuration file is read, other than to
create a configuration tree.  Essentially, we load all modules, and
determine the validity of IfDefine and IfModule directives.  All other
directives are evaluated later.

> Thus here are my questions:
> 1/ as 'PRE' is a latin prefix which means before, would it be possible
>    the sanity of the developpers to either:
>    a/ call it *before* the configuration is read.
>    b/ or rename it 'post_config';-)
>       then the 'post_config' can be renamed 'post_post_config';-)

No, neither is possible.  The pre refers to when we process the config,
not when it is read.

> 2/ if the pre_config is to be run anyway after the configuration file
>    read, could you suggest another hook I could use ? I can't see
>    and the developper documentation is rather scarse and not up to
> 3/ or explain what I missed in the source code to understand the logic
>    behind all that.

The easiest way to solve the problem you are looking at, is to mark the
Macro directives as EXEC_ON_READ, that will get the macros loaded while
we read the config file.  Then, in pre_config, walk the tree looking for
the macro names, and replace them with the definitions that you read in


View raw message