httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r1855748 - /httpd/httpd/trunk/modules/ssl/mod_ssl.c
Date Mon, 18 Mar 2019 10:18:55 GMT
Author: rpluem
Date: Mon Mar 18 10:18:55 2019
New Revision: 1855748

URL: http://svn.apache.org/viewvc?rev=1855748&view=rev
Log:
* 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.

Modified:
    httpd/httpd/trunk/modules/ssl/mod_ssl.c

Modified: httpd/httpd/trunk/modules/ssl/mod_ssl.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/mod_ssl.c?rev=1855748&r1=1855747&r2=1855748&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/mod_ssl.c (original)
+++ httpd/httpd/trunk/modules/ssl/mod_ssl.c Mon Mar 18 10:18:55 2019
@@ -490,10 +490,25 @@ static SSLConnRec *ssl_init_connection_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_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;
 }
 



Mime
View raw message