You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2025/11/24 22:08:05 UTC

(tomcat) branch 11.0.x updated: Simplify logic and only test aprStatusPresent when needed

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

markt 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 fb2e7822d5 Simplify logic and only test aprStatusPresent when needed
fb2e7822d5 is described below

commit fb2e7822d5a892bd903d493827d0b2e0cd894de4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Nov 24 22:06:04 2025 +0000

    Simplify logic and only test aprStatusPresent when needed
---
 java/org/apache/catalina/connector/Connector.java | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index af361f0b22..9dda386a08 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -1068,23 +1068,19 @@ public class Connector extends LifecycleMBeanBase {
             setParseBodyMethods(getParseBodyMethods());
         }
 
-        if (JreCompat.isJre22Available() && OpenSSLStatus.getUseOpenSSL() && OpenSSLStatus.isAvailable() &&
-                protocolHandler instanceof AbstractHttp11Protocol<?> jsseProtocolHandler) {
-            // Use FFM and OpenSSL if available
-            if (jsseProtocolHandler.isSSLEnabled() && jsseProtocolHandler.getSslImplementationName() == null) {
-                // OpenSSL is compatible with the JSSE configuration, so use it if it is available
+        if (protocolHandler instanceof AbstractHttp11Protocol<?> jsseProtocolHandler &&
+                jsseProtocolHandler.isSSLEnabled() && jsseProtocolHandler.getSslImplementationName() == null) {
+            // If SSL is enabled and a specific implementation isn't specified, select the correct default.
+            if (JreCompat.isJre22Available() && OpenSSLStatus.getUseOpenSSL() && OpenSSLStatus.isAvailable()) {
+                // Use FFM and OpenSSL if available
                 jsseProtocolHandler
                         .setSslImplementationName("org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation");
-            }
-        } else if (aprStatusPresent && AprStatus.isAprAvailable() && AprStatus.getUseOpenSSL() &&
-                protocolHandler instanceof AbstractHttp11Protocol<?> jsseProtocolHandler) {
-            // Use tomcat-native and OpenSSL otherwise, if available
-            if (jsseProtocolHandler.isSSLEnabled() && jsseProtocolHandler.getSslImplementationName() == null) {
-                // OpenSSL is compatible with the JSSE configuration, so use it if APR is available
+            } else if (aprStatusPresent && AprStatus.isAprAvailable() && AprStatus.getUseOpenSSL()) {
+                // Use tomcat-native and OpenSSL otherwise, if available
                 jsseProtocolHandler.setSslImplementationName(OpenSSLImplementation.class.getName());
             }
+            // Otherwise the default JSSE will be used
         }
-        // Otherwise the default JSSE will be used
 
         try {
             protocolHandler.init();


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