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

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

commit 5130880de0a83f405ad07e7061da128956b248cf
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 24 22:06:04 2025 +0000

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

diff --git a/java/org/apache/catalina/connector/Connector.java 
b/java/org/apache/catalina/connector/Connector.java
index c1ddb6713a..a5447c95ac 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -1063,25 +1063,21 @@ public class Connector extends LifecycleMBeanBase {
             setParseBodyMethods(getParseBodyMethods());
         }
 
-        if (JreCompat.isJre22Available() && OpenSSLStatus.getUseOpenSSL() && 
OpenSSLStatus.isAvailable() &&
-                protocolHandler instanceof AbstractHttp11Protocol) {
-            // Use FFM and OpenSSL if available
+        if (protocolHandler instanceof AbstractHttp11Protocol) {
             AbstractHttp11JsseProtocol<?> jsseProtocolHandler = 
(AbstractHttp11JsseProtocol<?>) protocolHandler;
             if (jsseProtocolHandler.isSSLEnabled() && 
jsseProtocolHandler.getSslImplementationName() == null) {
-                // OpenSSL is compatible with the JSSE configuration, so use 
it if it is available
-                jsseProtocolHandler
-                        
.setSslImplementationName("org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation");
-            }
-        } else if (aprStatusPresent && AprStatus.isAprAvailable() && 
AprStatus.getUseOpenSSL() &&
-                protocolHandler instanceof AbstractHttp11Protocol) {
-            // Use tomcat-native and OpenSSL otherwise, if available
-            AbstractHttp11JsseProtocol<?> jsseProtocolHandler = 
(AbstractHttp11JsseProtocol<?>) protocolHandler;
-            if (jsseProtocolHandler.isSSLEnabled() && 
jsseProtocolHandler.getSslImplementationName() == null) {
-                // OpenSSL is compatible with the JSSE configuration, so use 
it if APR is available
-                
jsseProtocolHandler.setSslImplementationName(OpenSSLImplementation.class.getName());
+                // 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()) {
+                    // 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to