Changeset 2591 for trunk/server/common/patches/httpd-fixup-vhost.patch
- Timestamp:
- Aug 27, 2014, 10:06:17 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
-
trunk/server/common/patches/httpd-fixup-vhost.patch
r1602 r2591 1 commit 3b081163d6250d893838d69d9a83f217c341d657 2 Author: Greg Brockman <gdb@mit.edu> 3 Date: Fri Aug 6 23:19:15 2010 -0400 1 From e90c8e59a93e5dde747e6dec7b960d2a6f2523ab Mon Sep 17 00:00:00 2001 2 From: Alexander Chernyakhovsky <achernya@mit.edu> 3 Date: Fri, 3 May 2013 22:43:28 -0400 4 Subject: [PATCH] Export method to fixup a single virtual host 4 5 5 Add method to merge virtual host with a main server_rec 6 Apache normally provides ap_fixup_virtual_hosts, which merges the 7 configuration from the main server into each virtual host. Refactor 8 this code to allow merging the configuration into a single virtual 9 host, and export this method for use in mod_vhost_ldap. 10 11 Additionally, call the newly created method in the loop in 12 ap_fixup_virtual_hosts. 13 --- 14 include/http_config.h | 9 ++++++++ 15 server/config.c | 58 ++++++++++++++++++++++++++++----------------------- 16 2 files changed, 41 insertions(+), 26 deletions(-) 6 17 7 18 diff --git a/include/http_config.h b/include/http_config.h 8 index 5e9fd51..8e6f24710064419 index 7ee3760..e3657ea 100644 9 20 --- a/include/http_config.h 10 21 +++ b/include/http_config.h 11 @@ -827,6 +827,16 @@ AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p); 12 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, 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, 13 25 server_rec *main_server); 14 15 26 +/** 16 + * Setup a single virtual host by merging the main server_rec into it.27 + * Setup all virtual hosts 17 28 + * @param p The pool to allocate from 18 + * @param main_server The server_rec with which to merge19 + * @param virt The virtual host server_rec with some set of directives to override already set29 + * @param main_server The head of the server_rec list 30 + * @param virt The individual virtual host to fix 20 31 + */ 21 32 +AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p, 22 33 + server_rec *main_server, 23 34 + server_rec *virt); 24 +25 /* For http_request.c... */26 35 27 36 /** 37 * Reserve some modules slots for modules loaded by other means than 28 38 diff --git a/server/config.c b/server/config.c 29 index 101d0e4..ef0f2ba10064439 index c1aae17..254c5d2 100644 30 40 --- a/server/config.c 31 41 +++ b/server/config.c 32 @@ -1902,38 +1902,43 @@ AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, 42 @@ -2245,46 +2245,52 @@ AP_DECLARE(void) ap_merge_log_config(const struct ap_logconf *old_conf, 43 } 33 44 } 34 35 45 36 46 -AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server) 37 47 +AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p, server_rec *main_server, 38 + 48 + server_rec *virt) 39 49 { 40 50 - server_rec *virt; 41 + merge_server_configs(p, main_server->module_config, 42 + virt->module_config); 51 core_dir_config *dconf = 52 ap_get_core_module_config(main_server->lookup_defaults); 53 dconf->log = &main_server->log; 43 54 44 55 - for (virt = main_server->next; virt; virt = virt->next) { 45 56 - merge_server_configs(p, main_server->module_config, 46 57 - virt->module_config); 47 + virt->lookup_defaults = 48 + ap_merge_per_dir_configs(p, main_server->lookup_defaults, 49 + virt->lookup_defaults); 58 + merge_server_configs(p, main_server->module_config, 59 + virt->module_config); 50 60 51 61 - virt->lookup_defaults = 52 62 - ap_merge_per_dir_configs(p, main_server->lookup_defaults, 53 63 - virt->lookup_defaults); 54 + if (virt->server_admin == NULL) 55 + virt->server_admin = main_server->server_admin; 64 + virt->lookup_defaults = 65 + ap_merge_per_dir_configs(p, main_server->lookup_defaults, 66 + virt->lookup_defaults); 56 67 57 68 - if (virt->server_admin == NULL) 58 69 - virt->server_admin = main_server->server_admin; 59 + if (virt-> timeout == 0)60 + virt->timeout = main_server->timeout;70 + if (virt->server_admin == NULL) 71 + virt->server_admin = main_server->server_admin; 61 72 62 73 - if (virt->timeout == 0) 63 74 - virt->timeout = main_server->timeout; 64 + if (virt-> keep_alive_timeout == 0)65 + virt->keep_alive_timeout = main_server->keep_alive_timeout;75 + if (virt->timeout == 0) 76 + virt->timeout = main_server->timeout; 66 77 67 78 - if (virt->keep_alive_timeout == 0) 68 79 - virt->keep_alive_timeout = main_server->keep_alive_timeout; 69 + if (virt->keep_alive == -1)70 + virt->keep_alive = main_server->keep_alive;80 + if (virt->keep_alive_timeout == 0) 81 + virt->keep_alive_timeout = main_server->keep_alive_timeout; 71 82 72 83 - if (virt->keep_alive == -1) 73 84 - virt->keep_alive = main_server->keep_alive; 74 + if (virt->keep_alive _max== -1)75 + virt->keep_alive_max = main_server->keep_alive_max;85 + if (virt->keep_alive == -1) 86 + virt->keep_alive = main_server->keep_alive; 76 87 77 88 - if (virt->keep_alive_max == -1) 78 89 - virt->keep_alive_max = main_server->keep_alive_max; 79 + /* XXX: this is really something that should be dealt with by a 80 + * post-config api phase 81 + */ 82 + ap_core_reorder_directories(p, virt); 83 +} 90 + if (virt->keep_alive_max == -1) 91 + virt->keep_alive_max = main_server->keep_alive_max; 92 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; 84 100 85 101 - /* XXX: this is really something that should be dealt with by a … … 88 104 - ap_core_reorder_directories(p, virt); 89 105 - } 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 + 90 112 +AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server) 91 113 +{ 92 114 + server_rec *virt; 93 + 115 + 94 116 + for (virt = main_server->next; virt; virt = virt->next) 95 117 + ap_fixup_virtual_host(p, main_server, virt); … … 97 119 ap_core_reorder_directories(p, main_server); 98 120 } 121 -- 122 1.8.1.2 123
Note: See TracChangeset
for help on using the changeset viewer.