]> granicus.if.org Git - apache/commitdiff
mod_proxy: follow up to r1729826: really copy conn->ssl_hostname.
authorYann Ylavic <ylavic@apache.org>
Thu, 11 Feb 2016 14:57:04 +0000 (14:57 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 11 Feb 2016 14:57:04 +0000 (14:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729847 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index 2be33ccd7bb50c4f69040b00a8636e617c7ef687..6949f2ce0e18cd23d1ea63296ad978867f261cdc 100644 (file)
@@ -2721,14 +2721,20 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
              * restore any ssl_hostname for this connection set earlier by
              * ap_proxy_determine_connection().
              */
-            const char *ssl_hostname = conn->ssl_hostname;
+            char ssl_hostname[PROXY_WORKER_MAX_HOSTNAME_SIZE];
+            if (!conn->ssl_hostname || PROXY_STRNCPY(ssl_hostname,
+                                                     conn->ssl_hostname)) {
+                ssl_hostname[0] = '\0';
+            }
 
             socket_cleanup(conn);
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00951)
                          "%s: backend socket is disconnected.",
                          proxy_function);
 
-            conn->ssl_hostname = apr_pstrdup(conn->scpool, ssl_hostname);
+            if (ssl_hostname[0]) {
+                conn->ssl_hostname = apr_pstrdup(conn->scpool, ssl_hostname);
+            }
         }
     }
     while ((backend_addr || conn->uds_path) && !connected) {