This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 1f079fc00e Refactor the strict SNI check for consistency.
1f079fc00e is described below
commit 1f079fc00e7a78d23fbe3fb3d9bb739f9244d6e3
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 0d26973dba..a8fc59cab5 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -944,10 +944,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 d910e8464c..3c46b59d6d 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]