source: trunk/server/common/patches/httpd-fixup-vhost.patch @ 2639

Last change on this file since 2639 was 2591, checked in by achernya, 8 years ago
Reintegrate fc20-dev into trunk
File size: 4.4 KB
  • include/http_config.h

    From e90c8e59a93e5dde747e6dec7b960d2a6f2523ab Mon Sep 17 00:00:00 2001
    From: Alexander Chernyakhovsky <achernya@mit.edu>
    Date: Fri, 3 May 2013 22:43:28 -0400
    Subject: [PATCH] Export method to fixup a single virtual host
    
    Apache normally provides ap_fixup_virtual_hosts, which merges the
    configuration from the main server into each virtual host.  Refactor
    this code to allow merging the configuration into a single virtual
    host, and export this method for use in mod_vhost_ldap.
    
    Additionally, call the newly created method in the loop in
    ap_fixup_virtual_hosts.
    ---
     include/http_config.h |  9 ++++++++
     server/config.c       | 58 ++++++++++++++++++++++++++++-----------------------
     2 files changed, 41 insertions(+), 26 deletions(-)
    
    diff --git a/include/http_config.h b/include/http_config.h
    index 7ee3760..e3657ea 100644
    a b AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p); 
    10121012 */
    10131013AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
    10141014                                        server_rec *main_server);
     1015/**
     1016 * Setup all virtual hosts
     1017 * @param p The pool to allocate from
     1018 * @param main_server The head of the server_rec list
     1019 * @param virt The individual virtual host to fix
     1020 */
     1021AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p,
     1022                                       server_rec *main_server,
     1023                                       server_rec *virt);
    10151024
    10161025/**
    10171026 * Reserve some modules slots for modules loaded by other means than
  • server/config.c

    diff --git a/server/config.c b/server/config.c
    index c1aae17..254c5d2 100644
    a b AP_DECLARE(void) ap_merge_log_config(const struct ap_logconf *old_conf, 
    22452245    }
    22462246}
    22472247
    2248 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
     2248AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p, server_rec *main_server,
     2249                                       server_rec *virt)
    22492250{
    2250     server_rec *virt;
    22512251    core_dir_config *dconf =
    22522252        ap_get_core_module_config(main_server->lookup_defaults);
    22532253    dconf->log = &main_server->log;
    22542254
    2255     for (virt = main_server->next; virt; virt = virt->next) {
    2256         merge_server_configs(p, main_server->module_config,
    2257                              virt->module_config);
     2255    merge_server_configs(p, main_server->module_config,
     2256                         virt->module_config);
    22582257
    2259         virt->lookup_defaults =
    2260             ap_merge_per_dir_configs(p, main_server->lookup_defaults,
    2261                                     virt->lookup_defaults);
     2258    virt->lookup_defaults =
     2259        ap_merge_per_dir_configs(p, main_server->lookup_defaults,
     2260                                virt->lookup_defaults);
    22622261
    2263         if (virt->server_admin == NULL)
    2264             virt->server_admin = main_server->server_admin;
     2262    if (virt->server_admin == NULL)
     2263        virt->server_admin = main_server->server_admin;
    22652264
    2266         if (virt->timeout == 0)
    2267             virt->timeout = main_server->timeout;
     2265    if (virt->timeout == 0)
     2266        virt->timeout = main_server->timeout;
    22682267
    2269         if (virt->keep_alive_timeout == 0)
    2270             virt->keep_alive_timeout = main_server->keep_alive_timeout;
     2268    if (virt->keep_alive_timeout == 0)
     2269        virt->keep_alive_timeout = main_server->keep_alive_timeout;
    22712270
    2272         if (virt->keep_alive == -1)
    2273             virt->keep_alive = main_server->keep_alive;
     2271    if (virt->keep_alive == -1)
     2272        virt->keep_alive = main_server->keep_alive;
    22742273
    2275         if (virt->keep_alive_max == -1)
    2276             virt->keep_alive_max = main_server->keep_alive_max;
     2274    if (virt->keep_alive_max == -1)
     2275        virt->keep_alive_max = main_server->keep_alive_max;
    22772276
    2278         ap_merge_log_config(&main_server->log, &virt->log);
     2277    ap_merge_log_config(&main_server->log, &virt->log);
    22792278
    2280         dconf = ap_get_core_module_config(virt->lookup_defaults);
    2281         dconf->log = &virt->log;
     2279    dconf = ap_get_core_module_config(virt->lookup_defaults);
     2280    dconf->log = &virt->log;
    22822281
    2283         /* XXX: this is really something that should be dealt with by a
    2284          * post-config api phase
    2285          */
    2286         ap_core_reorder_directories(p, virt);
    2287     }
     2282    /* XXX: this is really something that should be dealt with by a
     2283     * post-config api phase
     2284     */
     2285    ap_core_reorder_directories(p, virt);
     2286}
     2287
     2288AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
     2289{
     2290    server_rec *virt;
     2291   
     2292    for (virt = main_server->next; virt; virt = virt->next)
     2293        ap_fixup_virtual_host(p, main_server, virt);
    22882294
    22892295    ap_core_reorder_directories(p, main_server);
    22902296}
Note: See TracBrowser for help on using the repository browser.