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

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 65fd67d7e3d9ad8ed211c1fdeca91c4e75d81149
Author: Huw <m...@huw.org.uk>
AuthorDate: Wed Oct 4 01:32:22 2023 +0100

    CXF-8936: Ensure correct ConnectionFactory ordering in Jetty transport so 
that clients can negotiate h2 (#1454)
    
    (cherry picked from commit 202c5104380a1b9a49a5e84ead92e082ea5c7682)
    
    # Conflicts:
    #       
rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
---
 .../org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
 
b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index 658f155e8a..201706ceb9 100644
--- 
a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ 
b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -687,7 +687,6 @@ public class JettyHTTPServerEngine implements ServerEngine, 
HttpServerEngineSupp
             result = new org.eclipse.jetty.server.ServerConnector(server);
 
             if (tlsServerParameters != null) {
-                connectionFactories.add(httpFactory);
                 httpConfig.addCustomizer(new 
SecureRequestCustomizer(tlsServerParameters.isSniHostCheck()));
 
                 if (isHttp2Enabled(bus)) {
@@ -716,7 +715,7 @@ public class JettyHTTPServerEngine implements ServerEngine, 
HttpServerEngineSupp
                         }
                     }
                 }
-                if (connectionFactories.size() == 1) {
+                if (connectionFactories.isEmpty()) {
                     Constructor<SslConnectionFactory>[] cons 
                         = 
ReflectionUtil.getDeclaredConstructors(SslConnectionFactory.class);
                     for (Constructor<SslConnectionFactory> c : cons) {
@@ -728,6 +727,9 @@ public class JettyHTTPServerEngine implements ServerEngine, 
HttpServerEngineSupp
                         }
                     }
                 }
+                
+                // Ensure http/1.1 is last in the list so it is the lowest 
priority in ALPN
+                connectionFactories.add(httpFactory);
 
                 // Has to be set before the default protocol change
                 result.setConnectionFactories(connectionFactories);

Reply via email to