commit 3b081163d6250d893838d69d9a83f217c341d657
Author: Greg Brockman <gdb@mit.edu>
Date:   Fri Aug 6 23:19:15 2010 -0400

    Add method to merge virtual host with a main server_rec

diff --git a/include/http_config.h b/include/http_config.h
index 5e9fd51..8e6f247 100644
--- a/include/http_config.h
+++ b/include/http_config.h
@@ -827,6 +827,16 @@ AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, 
                                         server_rec *main_server);
 
+/**
+ * Setup a single virtual host by merging the main server_rec into it.
+ * @param p The pool to allocate from
+ * @param main_server The server_rec with which to merge
+ * @param virt The virtual host server_rec with some set of directives to override already set
+ */
+AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p,
+				       server_rec *main_server,
+				       server_rec *virt);
+
 /* For http_request.c... */
 
 /**
diff --git a/server/config.c b/server/config.c
index 101d0e4..ef0f2ba 100644
--- a/server/config.c
+++ b/server/config.c
@@ -1902,38 +1902,43 @@ AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p,
 }
 
 
-AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
+AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p, server_rec *main_server,
+                                       server_rec *virt)
 {
-    server_rec *virt;
+    merge_server_configs(p, main_server->module_config,
+                         virt->module_config);
 
-    for (virt = main_server->next; virt; virt = virt->next) {
-        merge_server_configs(p, main_server->module_config,
-                             virt->module_config);
+    virt->lookup_defaults =
+        ap_merge_per_dir_configs(p, main_server->lookup_defaults,
+                                 virt->lookup_defaults);
 
-        virt->lookup_defaults =
-            ap_merge_per_dir_configs(p, main_server->lookup_defaults,
-                                     virt->lookup_defaults);
+    if (virt->server_admin == NULL)
+        virt->server_admin = main_server->server_admin;
 
-        if (virt->server_admin == NULL)
-            virt->server_admin = main_server->server_admin;
+    if (virt->timeout == 0)
+        virt->timeout = main_server->timeout;
 
-        if (virt->timeout == 0)
-            virt->timeout = main_server->timeout;
+    if (virt->keep_alive_timeout == 0)
+        virt->keep_alive_timeout = main_server->keep_alive_timeout;
 
-        if (virt->keep_alive_timeout == 0)
-            virt->keep_alive_timeout = main_server->keep_alive_timeout;
+    if (virt->keep_alive == -1)
+        virt->keep_alive = main_server->keep_alive;
 
-        if (virt->keep_alive == -1)
-            virt->keep_alive = main_server->keep_alive;
+    if (virt->keep_alive_max == -1)
+        virt->keep_alive_max = main_server->keep_alive_max;
 
-        if (virt->keep_alive_max == -1)
-            virt->keep_alive_max = main_server->keep_alive_max;
+    /* XXX: this is really something that should be dealt with by a
+     * post-config api phase
+     */
+    ap_core_reorder_directories(p, virt);
+}
 
-        /* XXX: this is really something that should be dealt with by a
-         * post-config api phase
-         */
-        ap_core_reorder_directories(p, virt);
-    }
+AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
+{
+    server_rec *virt;
+
+    for (virt = main_server->next; virt; virt = virt->next)
+        ap_fixup_virtual_host(p, main_server, virt);
 
     ap_core_reorder_directories(p, main_server);
 }
