Geoffrey Young wrote:

William A. Rowe, Jr. wrote:


Only question below is should this hook always run before or after the post config hook? My gut says after post config.


just going from what you had said earlier:


It is almost worth a totally different hook entry point (before post_config) such as vhost_init which *would* be called per-vhost (starting from the main server config and working through the list.)


:)

but now that I think about it, if post_config is where module init stuff
lives, then it feels right to have vhosts initialized prior to that, since
the new hook seems like more of a config-type thing.  but it's not hard to
see how someone could have the opposite viewpoint, so no strong feelings
here either way.

the only other (unrelated) thought that I had was that it might be more
self-documenting to name it host_init rather than vhost_init, keeping it
very obvious that it runs for the main server as well as any configured vhosts.

I'm not sure this is a good idea to run it on the main host. If it was we could just as well run post_config for each vhost as well. The problem is that if that hook is configurable via a directive this directive will be inherited by all vhosts if defined in the main server (via the usual merge rules). And you end up running it for each vhost even if you didn't intend to.


So if adding this hook at all, it should be invoked *only* on vhosts, and never on the main server i.e.:

+    for (s = server_conf->next; s; s = s->next) {
              ^^^^^^^^^^^^^^^^^^
+        if ( ap_run_vhost_init(pconf, plog, ptemp, s) != OK) {
+            ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
+                         0, NULL, "Unable to initialize virtual hosts\n");
+            destroy_and_exit_process(process, 1);
+       }
+    }

and then vhost_init is the right choice.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to