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

Last change on this file since 2132 was 1602, checked in by gdb, 14 years ago
httpd: Add method to merge virtual host with a main server_rec
File size: 3.5 KB
  • include/http_config.h

    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 b AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p); 
    827827AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
    828828                                        server_rec *main_server);
    829829
     830/**
     831 * Setup a single virtual host by merging the main server_rec into it.
     832 * @param p The pool to allocate from
     833 * @param main_server The server_rec with which to merge
     834 * @param virt The virtual host server_rec with some set of directives to override already set
     835 */
     836AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p,
     837                                       server_rec *main_server,
     838                                       server_rec *virt);
     839
    830840/* For http_request.c... */
    831841
    832842/**
  • server/config.c

    diff --git a/server/config.c b/server/config.c
    index 101d0e4..ef0f2ba 100644
    a b AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, 
    19021902}
    19031903
    19041904
    1905 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
     1905AP_DECLARE(void) ap_fixup_virtual_host(apr_pool_t *p, server_rec *main_server,
     1906                                       server_rec *virt)
    19061907{
    1907     server_rec *virt;
     1908    merge_server_configs(p, main_server->module_config,
     1909                         virt->module_config);
    19081910
    1909     for (virt = main_server->next; virt; virt = virt->next) {
    1910         merge_server_configs(p, main_server->module_config,
    1911                              virt->module_config);
     1911    virt->lookup_defaults =
     1912        ap_merge_per_dir_configs(p, main_server->lookup_defaults,
     1913                                 virt->lookup_defaults);
    19121914
    1913         virt->lookup_defaults =
    1914             ap_merge_per_dir_configs(p, main_server->lookup_defaults,
    1915                                      virt->lookup_defaults);
     1915    if (virt->server_admin == NULL)
     1916        virt->server_admin = main_server->server_admin;
    19161917
    1917         if (virt->server_admin == NULL)
    1918             virt->server_admin = main_server->server_admin;
     1918    if (virt->timeout == 0)
     1919        virt->timeout = main_server->timeout;
    19191920
    1920         if (virt->timeout == 0)
    1921             virt->timeout = main_server->timeout;
     1921    if (virt->keep_alive_timeout == 0)
     1922        virt->keep_alive_timeout = main_server->keep_alive_timeout;
    19221923
    1923         if (virt->keep_alive_timeout == 0)
    1924             virt->keep_alive_timeout = main_server->keep_alive_timeout;
     1924    if (virt->keep_alive == -1)
     1925        virt->keep_alive = main_server->keep_alive;
    19251926
    1926         if (virt->keep_alive == -1)
    1927             virt->keep_alive = main_server->keep_alive;
     1927    if (virt->keep_alive_max == -1)
     1928        virt->keep_alive_max = main_server->keep_alive_max;
    19281929
    1929         if (virt->keep_alive_max == -1)
    1930             virt->keep_alive_max = main_server->keep_alive_max;
     1930    /* XXX: this is really something that should be dealt with by a
     1931     * post-config api phase
     1932     */
     1933    ap_core_reorder_directories(p, virt);
     1934}
    19311935
    1932         /* XXX: this is really something that should be dealt with by a
    1933          * post-config api phase
    1934          */
    1935         ap_core_reorder_directories(p, virt);
    1936     }
     1936AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
     1937{
     1938    server_rec *virt;
     1939
     1940    for (virt = main_server->next; virt; virt = virt->next)
     1941        ap_fixup_virtual_host(p, main_server, virt);
    19371942
    19381943    ap_core_reorder_directories(p, main_server);
    19391944}
Note: See TracBrowser for help on using the repository browser.