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

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


The following commit(s) were added to refs/heads/main by this push:
     new 7ed7a2e3b6 Simplify logic and only test aprStatusPresent when needed
7ed7a2e3b6 is described below

commit 7ed7a2e3b6949a5a26237d09fd31f16029a2926f
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 | 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to