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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-native.git

commit 825fc23733a82c28f005c365caa7e724fa437b5a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Mar 26 09:44:32 2021 +0000

    Update java code to align with 10.0.x
---
 java/org/apache/tomcat/jni/SSLContext.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/jni/SSLContext.java 
b/java/org/apache/tomcat/jni/SSLContext.java
index e0759b3..1810571 100644
--- a/java/org/apache/tomcat/jni/SSLContext.java
+++ b/java/org/apache/tomcat/jni/SSLContext.java
@@ -17,6 +17,7 @@
 
 package org.apache.tomcat.jni;
 
+import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -416,7 +417,10 @@ public final class SSLContext {
         if (sniCallBack == null) {
             return 0;
         }
-        return sniCallBack.getSslContext(sniHostName);
+        // Can't be sure OpenSSL is going to provide the SNI value in lower 
case
+        // so convert it before looking up the SSLContext
+        String hostName = (sniHostName == null) ? null : 
sniHostName.toLowerCase(Locale.ENGLISH);
+        return sniCallBack.getSslContext(hostName);
     }
 
     /**
@@ -470,7 +474,8 @@ public final class SSLContext {
          * This callback is made during the TLS handshake when the client uses
          * the SNI extension to request a specific TLS host.
          *
-         * @param sniHostName The host name requested by the client
+         * @param sniHostName The host name requested by the client - must be 
in
+         *                    lower case
          *
          * @return The Java representation of the pointer to the OpenSSL
          *         SSLContext to use for the given host or zero if no 
SSLContext

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

Reply via email to