source: branches/fc19-dev/server/common/patches/httpd-fixup-vhost.patch @ 2439

Last change on this file since 2439 was 2439, checked in by achernya, 9 years ago
Fix mod_status-security to actually work Upstream changed the semantics of this module, and the initial rebase mistakenly included too much upstream code.
File size: 4.4 KB
RevLine 
[2439]1From 373eb8f72153417173d8ecdf11223fba0a740c19 Mon Sep 17 00:00:00 2001
[2422]2From: Alexander Chernyakhovsky <achernya@mit.edu>
3Date: Fri, 3 May 2013 22:43:28 -0400
4Subject: [PATCH 4/4] Export method to fixup a single virtual host
[1602]5
[2422]6Apache normally provides ap_fixup_virtual_hosts, which merges the
7configuration from the main server into each virtual host.  Refactor
8this code to allow merging the configuration into a single virtual
9host, and export this method for use in mod_vhost_ldap.
[1602]10
[2422]11Additionally, call the newly created method in the loop in
12ap_fixup_virtual_hosts.
13---
14 include/http_config.h |    9 ++++++++
15 server/config.c       |   58 +++++++++++++++++++++++++++----------------------
16 2 files changed, 41 insertions(+), 26 deletions(-)
17
[1602]18diff --git a/include/http_config.h b/include/http_config.h
[2422]19index 7ee3760..e3657ea 100644
[1602]20--- a/include/http_config.h
21+++ b/include/http_config.h
[2422]22@@ -1012,6 +1012,15 @@ AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
23  */
24 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
[1602]25                                         server_rec *main_server);
26+/**
[2422]27+ * Setup all virtual hosts
[1602]28+ * @param p The pool to allocate from
[2422]29+ * @param main_server The head of the server_rec list
30+ * @param virt The individual virtual host to fix
[1602]31+ */
32+AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p,
33+                                      server_rec *main_server,
34+                                      server_rec *virt);
35 
36 /**
[2422]37  * Reserve some modules slots for modules loaded by other means than
[1602]38diff --git a/server/config.c b/server/config.c
[2439]39index bc0804a..22a131e 100644
[1602]40--- a/server/config.c
41+++ b/server/config.c
[2422]42@@ -2246,46 +2246,52 @@ AP_DECLARE(void) ap_merge_log_config(const struct ap_logconf *old_conf,
43     }
[1602]44 }
45 
46-AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
47+AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p, server_rec *main_server,
[2422]48+                                      server_rec *virt)
[1602]49 {
50-    server_rec *virt;
[2422]51     core_dir_config *dconf =
52         ap_get_core_module_config(main_server->lookup_defaults);
53     dconf->log = &main_server->log;
[1602]54 
55-    for (virt = main_server->next; virt; virt = virt->next) {
56-        merge_server_configs(p, main_server->module_config,
57-                             virt->module_config);
[2422]58+    merge_server_configs(p, main_server->module_config,
59+                        virt->module_config);
[1602]60 
61-        virt->lookup_defaults =
62-            ap_merge_per_dir_configs(p, main_server->lookup_defaults,
63-                                     virt->lookup_defaults);
[2422]64+    virt->lookup_defaults =
65+       ap_merge_per_dir_configs(p, main_server->lookup_defaults,
66+                                virt->lookup_defaults);
[1602]67 
68-        if (virt->server_admin == NULL)
69-            virt->server_admin = main_server->server_admin;
[2422]70+    if (virt->server_admin == NULL)
71+       virt->server_admin = main_server->server_admin;
[1602]72 
73-        if (virt->timeout == 0)
74-            virt->timeout = main_server->timeout;
[2422]75+    if (virt->timeout == 0)
76+       virt->timeout = main_server->timeout;
[1602]77 
78-        if (virt->keep_alive_timeout == 0)
79-            virt->keep_alive_timeout = main_server->keep_alive_timeout;
[2422]80+    if (virt->keep_alive_timeout == 0)
81+       virt->keep_alive_timeout = main_server->keep_alive_timeout;
[1602]82 
83-        if (virt->keep_alive == -1)
84-            virt->keep_alive = main_server->keep_alive;
[2422]85+    if (virt->keep_alive == -1)
86+       virt->keep_alive = main_server->keep_alive;
[1602]87 
88-        if (virt->keep_alive_max == -1)
89-            virt->keep_alive_max = main_server->keep_alive_max;
[2422]90+    if (virt->keep_alive_max == -1)
91+       virt->keep_alive_max = main_server->keep_alive_max;
[1602]92 
[2422]93-        ap_merge_log_config(&main_server->log, &virt->log);
94+    ap_merge_log_config(&main_server->log, &virt->log);
95 
96-        dconf = ap_get_core_module_config(virt->lookup_defaults);
97-        dconf->log = &virt->log;
98+    dconf = ap_get_core_module_config(virt->lookup_defaults);
99+    dconf->log = &virt->log;
100 
[1602]101-        /* XXX: this is really something that should be dealt with by a
102-         * post-config api phase
103-         */
104-        ap_core_reorder_directories(p, virt);
105-    }
[2422]106+    /* XXX: this is really something that should be dealt with by a
107+     * post-config api phase
108+     */
109+    ap_core_reorder_directories(p, virt);
110+}
111+
[1602]112+AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
113+{
114+    server_rec *virt;
[2422]115+   
[1602]116+    for (virt = main_server->next; virt; virt = virt->next)
117+        ap_fixup_virtual_host(p, main_server, virt);
118 
119     ap_core_reorder_directories(p, main_server);
120 }
[2422]121--
1221.7.9.6 (Apple Git-31.1)
123
Note: See TracBrowser for help on using the repository browser.