From: Jeff Trawick Date: Sun, 11 Jun 2000 22:06:57 +0000 (+0000) Subject: Fix a couple of problems with the pre/post config processing changes: X-Git-Tag: APACHE_2_0_ALPHA_5~371 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8591e550e0d0109c81352b1c47547dff5d26552;p=apache Fix a couple of problems with the pre/post config processing changes: 1) symptom: on system with bad/no DNS setup, ServerName isn't processed so init fails cause: ap_fini_vhost_config() called before ap_process_config_tree(), so ServerName was never stored in the config structure 2) symptom: on system with virtual hosts configured, SIGSEGV in open_multi_logs() cause: the module configs for the virtual hosts haven't been merged in yet, and open_multi_logs() gets NULL for the mod_log_config configuration This stuff needs to be cleaned up further, exploring the use of a post-config hook for fixup_virtual_hosts(), ap_fini_vhost_config(), and ap_sort_hooks(), getting a lot of logic out of main(), and processing the config tree only once. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85522 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_config.h b/include/http_config.h index 330c822086..b528bb32f3 100644 --- a/include/http_config.h +++ b/include/http_config.h @@ -385,6 +385,7 @@ API_EXPORT(void) ap_pre_config_hook(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t API_EXPORT(void) ap_post_config_hook(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *s); API_EXPORT(void) ap_run_rewrite_args(process_rec *process); API_EXPORT(void) ap_register_hooks(module *m); +API_EXPORT(void) ap_fixup_virtual_hosts(ap_pool_t *p, server_rec *main_server); /* For http_request.c... */ diff --git a/server/config.c b/server/config.c index 7a2cf30222..b4abd98b64 100644 --- a/server/config.c +++ b/server/config.c @@ -1479,7 +1479,7 @@ CORE_EXPORT(const char *) ap_init_virtual_host(ap_pool_t *p, const char *hostnam } -static void fixup_virtual_hosts(ap_pool_t *p, server_rec *main_server) +API_EXPORT(void) ap_fixup_virtual_hosts(ap_pool_t *p, server_rec *main_server) { server_rec *virt; @@ -1576,10 +1576,6 @@ API_EXPORT(server_rec*) ap_read_config(process_rec *process, ap_pool_t *ptemp, process_command_config(s, ap_server_post_read_config, conftree, p, ptemp); - fixup_virtual_hosts(p, s); - ap_fini_vhost_config(p, s); - ap_sort_hooks(); - return s; } diff --git a/server/main.c b/server/main.c index ddd9530a9e..8b58ab1e63 100644 --- a/server/main.c +++ b/server/main.c @@ -62,6 +62,7 @@ #include "http_main.h" #include "http_log.h" #include "http_config.h" +#include "http_vhost.h" #include "util_uri.h" #include "util_ebcdic.h" #include "apr_getopt.h" @@ -371,6 +372,9 @@ int main(int argc, char *argv[]) server_conf = ap_read_config(process, ptemp, confname, &conftree); ap_run_pre_config(pconf, plog, ptemp); ap_process_config_tree(server_conf, conftree, process->pconf, ptemp); + ap_fixup_virtual_hosts(pconf, server_conf); + ap_fini_vhost_config(pconf, server_conf); + ap_sort_hooks(); if (configtestonly) { ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n"); destroy_and_exit_process(process, 0); @@ -396,6 +400,9 @@ int main(int argc, char *argv[]) server_conf = ap_read_config(process, ptemp, confname, &conftree); ap_run_pre_config(pconf, plog, ptemp); ap_process_config_tree(server_conf, conftree, process->pconf, ptemp); + ap_fixup_virtual_hosts(pconf, server_conf); + ap_fini_vhost_config(pconf, server_conf); + ap_sort_hooks(); ap_clear_pool(plog); ap_run_open_logs(pconf, plog, ptemp, server_conf); ap_post_config_hook(pconf, plog, ptemp, server_conf);