Skip to content

Commit

Permalink
CXF-8936: Ensure correct ConnectionFactory ordering in Jetty transpor…
Browse files Browse the repository at this point in the history
…t so that clients can negotiate h2 (#1454)
  • Loading branch information
huw0 committed Oct 4, 2023
1 parent edafd05 commit 202c510
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ AbstractConnector createConnectorJetty(SslContextFactory.Server sslcf, String ho
result = new org.eclipse.jetty.server.ServerConnector(server);

if (tlsServerParameters != null) {
connectionFactories.add(httpFactory);
httpConfig.addCustomizer(new SecureRequestCustomizer(tlsServerParameters.isSniHostCheck()));

if (isHttp2Enabled(bus)) {
Expand All @@ -704,10 +703,14 @@ AbstractConnector createConnectorJetty(SslContextFactory.Server sslcf, String ho
}
}
}
if (connectionFactories.size() == 1) {

if (connectionFactories.isEmpty()) {
final SslConnectionFactory scf = new SslConnectionFactory(sslcf, httpFactory.getProtocol());
connectionFactories.add(scf);
}

// 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);
Expand Down

0 comments on commit 202c510

Please sign in to comment.