This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 4e83411ad822abf8adb0c1e3717a4ca74264523b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 28 09:58:43 2021 +0000

    Ensure the name of the default SSLHostConfig is always lower case
    
    This is the third part of the fix to make mapping of SNI values to SSL
    virtual hosts case insensitive.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 7 ++++++-
 java/org/apache/tomcat/util/net/SSLHostConfig.java    | 3 +++
 webapps/docs/config/http.xml                          | 3 ++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 2c455c3..1583faf 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -27,6 +27,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -223,11 +224,15 @@ public abstract class AbstractEndpoint<S,U> {
     // ----------------------------------------------------------------- 
Properties
 
     private String defaultSSLHostConfigName = 
SSLHostConfig.DEFAULT_SSL_HOST_NAME;
+    /**
+     * @return The host name for the default SSL configuration for this 
endpoint
+     *         - always in lower case.
+     */
     public String getDefaultSSLHostConfigName() {
         return defaultSSLHostConfigName;
     }
     public void setDefaultSSLHostConfigName(String defaultSSLHostConfigName) {
-        this.defaultSSLHostConfigName = defaultSSLHostConfigName;
+        this.defaultSSLHostConfigName = 
defaultSSLHostConfigName.toLowerCase(Locale.ENGLISH);
     }
 
 
diff --git a/java/org/apache/tomcat/util/net/SSLHostConfig.java 
b/java/org/apache/tomcat/util/net/SSLHostConfig.java
index 0cebd12..2fed68e 100644
--- a/java/org/apache/tomcat/util/net/SSLHostConfig.java
+++ b/java/org/apache/tomcat/util/net/SSLHostConfig.java
@@ -49,6 +49,9 @@ public class SSLHostConfig implements Serializable {
     private static final Log log = LogFactory.getLog(SSLHostConfig.class);
     private static final StringManager sm = 
StringManager.getManager(SSLHostConfig.class);
 
+    // Must be lower case. SSL host names are always stored using lower case as
+    // they are case insensitive but are used by case sensitive code such as
+    // keys in Maps.
     protected static final String DEFAULT_SSL_HOST_NAME = "_default_";
     protected static final Set<String> SSL_PROTO_ALL_SET = new HashSet<>();
 
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index 2469863..ee684eb 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -106,7 +106,8 @@
       connections) if the client connection does not provide SNI or if the SNI
       is provided but does not match any configured
       <strong>SSLHostConfig</strong>. If not specified the default value of
-      <code>_default_</code> will be used.</p>
+      <code>_default_</code> will be used. Provided values are always converted
+      to lower case.</p>
     </attribute>
 
     <attribute name="discardFacades" required="false">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to