From 4d1d0c92cd67899d4335d2fe3535573aa0dfc4db Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Mon, 18 Mar 2019 10:18:55 +0000 Subject: [PATCH] * 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 --- modules/ssl/mod_ssl.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index 9a2e746040..fa7aa067f7 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -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; } -- 2.50.1