From a12a2f34e5f69b2be101dce6bb342ec4ee965698 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Wed, 24 Mar 2021 12:36:49 +0100 Subject: [PATCH] clean up alpn protocol configuration Signed-off-by: Ludovic Orban --- .../jetty/http3/client/ClientQuicConnector.java | 14 ++------------ .../client/HttpClientTransportOverQuic.java | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java index f72ed282d26..e66b83be987 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java @@ -69,19 +69,9 @@ public class ClientQuicConnector extends ContainerLifeCycle implements IClientCo private SocketAddress bindAddress; private boolean reuseAddress = true; - public ClientQuicConnector(Origin.Protocol protocol) + public ClientQuicConnector(QuicheConfig quicheConfig) { - // TODO make the QuicheConfig configurable - quicheConfig = new QuicheConfig(); - quicheConfig.setApplicationProtos(protocol.getProtocols().toArray(new String[0])); - quicheConfig.setMaxIdleTimeout(5000L); - quicheConfig.setInitialMaxData(10000000L); - quicheConfig.setInitialMaxStreamDataBidiLocal(10000000L); - quicheConfig.setInitialMaxStreamDataUni(10000000L); - quicheConfig.setInitialMaxStreamsBidi(100L); - quicheConfig.setInitialMaxStreamsUni(100L); - quicheConfig.setDisableActiveMigration(true); - quicheConfig.setVerifyPeer(false); + this.quicheConfig = quicheConfig; } public Executor getExecutor() diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java index ef25349279e..f1333a41787 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.client.MultiplexConnectionPool; import org.eclipse.jetty.client.MultiplexHttpDestination; import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.client.http.HttpClientConnectionFactory; +import org.eclipse.jetty.http3.quiche.QuicheConfig; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.Connection; @@ -50,8 +51,21 @@ public class HttpClientTransportOverQuic extends AbstractHttpClientTransport public HttpClientTransportOverQuic(ClientConnectionFactory.Info... factoryInfos) { List protocolNames = Arrays.stream(factoryInfos).flatMap(info -> info.getProtocols(true).stream()).collect(Collectors.toList()); + + // TODO make the QuicheConfig configurable + QuicheConfig quicheConfig = new QuicheConfig(); + quicheConfig.setApplicationProtos(protocolNames.toArray(new String[0])); + quicheConfig.setMaxIdleTimeout(5000L); + quicheConfig.setInitialMaxData(10000000L); + quicheConfig.setInitialMaxStreamDataBidiLocal(10000000L); + quicheConfig.setInitialMaxStreamDataUni(10000000L); + quicheConfig.setInitialMaxStreamsBidi(100L); + quicheConfig.setInitialMaxStreamsUni(100L); + quicheConfig.setDisableActiveMigration(true); + quicheConfig.setVerifyPeer(false); + protocol = new Origin.Protocol(protocolNames, false); - connector = new ClientQuicConnector(protocol); + connector = new ClientQuicConnector(quicheConfig); addBean(connector); setConnectionPoolFactory(destination -> {