Commit 0aad171a authored by Ruediger Pluem's avatar Ruediger Pluem
Browse files

* Solve a chicken and egg problem here:

  We need to have sslconn->dc set correctly when we want to
  init sslconn, but we need to allocate memory for it first.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855748 13f79535-47bb-0310-9956-ffa450edef68
parent a68bc82a
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -490,10 +490,25 @@ static SSLConnRec *ssl_init_connection_ctx(conn_rec *c,
                                           int new_proxy)
{
    SSLConnRec *sslconn = myConnConfig(c);
    int need_setup = 0;

    if (!sslconn) {
        sslconn = apr_pcalloc(c->pool, sizeof(*sslconn));
        need_setup = 1;
    }

    /* Reinit dc in any case because it may be r->per_dir_config scoped
     * and thus a caller like mod_proxy needs to update it per request.
     */
    if (per_dir_config) {
        sslconn->dc = ap_get_module_config(per_dir_config, &ssl_module);
    }
    else {
        sslconn->dc = ap_get_module_config(c->base_server->lookup_defaults,
                                           &ssl_module);
    }

    if (need_setup) {
        sslconn->server = c->base_server;
        sslconn->verify_depth = UNSET;
        if (new_proxy) {
@@ -508,17 +523,6 @@ static SSLConnRec *ssl_init_connection_ctx(conn_rec *c,
        myConnConfigSet(c, sslconn);
    }

    /* Reinit dc in any case because it may be r->per_dir_config scoped
     * and thus a caller like mod_proxy needs to update it per request.
     */
    if (per_dir_config) {
        sslconn->dc = ap_get_module_config(per_dir_config, &ssl_module);
    }
    else {
        sslconn->dc = ap_get_module_config(c->base_server->lookup_defaults,
                                           &ssl_module);
    }

    return sslconn;
}