Use valid protocol names in ALPN configuration
@@ -20,7 +20,6 @@ import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
-import java.util.Collection;
import java.util.List;
/**
@@ -103,7 +102,7 @@ public class ConnectorFactory {
HttpConnectionFactory http1Factory = newHttp1ConnectionFactory();
if (connectorConfig.http2Enabled()) {
HTTP2ServerConnectionFactory http2Factory = newHttp2ConnectionFactory();
- ALPNServerConnectionFactory alpnFactory = newAlpnConnectionFactory(List.of(http1Factory, http2Factory), http1Factory);
+ ALPNServerConnectionFactory alpnFactory = newAlpnConnectionFactory();
SslConnectionFactory sslFactory = newSslConnectionFactory(metric, alpnFactory);
if (proxyProtocolConfig.enabled()) {
ProxyConnectionFactory proxyProtocolFactory = newProxyProtocolConnectionFactory(sslFactory);
@@ -170,11 +169,9 @@ public class ConnectorFactory {
return connectionFactory;
}
- private ALPNServerConnectionFactory newAlpnConnectionFactory(Collection<ConnectionFactory> alternatives,
- ConnectionFactory defaultFactory) {
- String[] protocols = alternatives.stream().map(ConnectionFactory::getProtocol).toArray(String[]::new);
- ALPNServerConnectionFactory factory = new ALPNServerConnectionFactory(protocols);
- factory.setDefaultProtocol(defaultFactory.getProtocol());
+ private ALPNServerConnectionFactory newAlpnConnectionFactory() {
+ ALPNServerConnectionFactory factory = new ALPNServerConnectionFactory("h2", "http/1.1");
+ factory.setDefaultProtocol("http/1.1");
return factory;
}
