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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 89f5f709e9 Refactor the strict SNI check for consistency.
89f5f709e9 is described below

commit 89f5f709e9ea16a6f65eb699eb78c8fd4420f347
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Nov 19 15:44:14 2026 +0000

    Refactor the strict SNI check for consistency.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 12 +++++++++---
 webapps/docs/changelog.xml                            |  3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 826dd700cd..a538ba1ef8 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -676,10 +676,16 @@ public abstract class AbstractEndpoint<S, U> {
         if (protocolHostName != null && protocolHostName.endsWith(".")) {
             protocolHostName = protocolHostName.substring(0, 
protocolHostName.length() - 1);
         }
+        /*
+         * String.toLowerCase(Locale.ENGLISH) has slightly different behaviour 
to String.equalsIgnoreCase(String) so for
+         * consistency convert both host names to lower case first.
+         */
+        String lcProtocolHostName = protocolHostName != null ? 
protocolHostName.toLowerCase(Locale.ENGLISH) : null;
+        String lcSniHostName = sniHostName != null ? 
sniHostName.toLowerCase(Locale.ENGLISH) : null;
+
         return (!strictSni || !isSSLEnabled()
-                || (sniHostName != null && 
sniHostName.equalsIgnoreCase(protocolHostName))
-                || getSSLHostConfig(sniHostName) == getSSLHostConfig(
-                        protocolHostName != null ? 
protocolHostName.toLowerCase(Locale.ENGLISH) : null));
+                || (lcSniHostName != null && 
lcSniHostName.equals(lcProtocolHostName))
+                || getSSLHostConfig(lcSniHostName) == 
getSSLHostConfig(lcProtocolHostName));
     }
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 24b14b1b63..aaf395afd9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -219,6 +219,9 @@
         client protocol version is unknown. Default to HTTP/1.1 for the error
         response. (markt)
       </fix>
+      <fix>
+        Refactor the strict SNI check for consistency. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to