]> granicus.if.org Git - apache/commitdiff
Fix a couple of problems with the pre/post config processing changes:
authorJeff Trawick <trawick@apache.org>
Sun, 11 Jun 2000 22:06:57 +0000 (22:06 +0000)
committerJeff Trawick <trawick@apache.org>
Sun, 11 Jun 2000 22:06:57 +0000 (22:06 +0000)
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

include/http_config.h
server/config.c
server/main.c

index 330c82208682ae507347d49db7caf8e72971af1c..b528bb32f38b8070d556611994c1b4264f9e725b 100644 (file)
@@ -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... */
 
index 7a2cf302222895c9366689250173ad85ad0f4f63..b4abd98b64202df82150e630e59a5a847df6c1be 100644 (file)
@@ -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;
 }
 
index ddd9530a9e77297f0c7a46d16d123a1fc9694fc4..8b58ab1e6336ad10f496034be73a4ff3f5dda72b 100644 (file)
@@ -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);