From ed9db7f095c18179c28d7aa1aa8f4eeff0b8f759 Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Tue, 21 Dec 2021 09:41:19 +0100 Subject: [PATCH] The Http2Settings max header list size setting is ignored by the conversion to the actual Netty settings since we only send a setting when the new value is different from the initial value. The initial value is wrong and therefore leads to obtaining the incorrect value. fixes #4211 --- .../java/io/vertx/core/http/Http2Settings.java | 4 ++-- src/test/java/io/vertx/core/http/Http2Test.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/vertx/core/http/Http2Settings.java b/src/main/java/io/vertx/core/http/Http2Settings.java index 5ce4a7ea66b..da632482ddc 100644 --- a/src/main/java/io/vertx/core/http/Http2Settings.java +++ b/src/main/java/io/vertx/core/http/Http2Settings.java @@ -57,9 +57,9 @@ public class Http2Settings { public static final int DEFAULT_MAX_FRAME_SIZE = 16384; /** - * Default HTTP/2 spec value for {@link #getMaxHeaderListSize} : {@code Integer.MAX_VALUE} + * Default HTTP/2 spec value for {@link #getMaxHeaderListSize} : {@code 8192} */ - public static final int DEFAULT_MAX_HEADER_LIST_SIZE = Integer.MAX_VALUE; + public static final int DEFAULT_MAX_HEADER_LIST_SIZE = 8192; /** * Default HTTP/2 spec value for {@link #getExtraSettings} : {@code null} diff --git a/src/test/java/io/vertx/core/http/Http2Test.java b/src/test/java/io/vertx/core/http/Http2Test.java index 7f783f9a19c..9ddfbdef10a 100644 --- a/src/test/java/io/vertx/core/http/Http2Test.java +++ b/src/test/java/io/vertx/core/http/Http2Test.java @@ -503,6 +503,23 @@ public void testInitialMaxConcurrentStreamZero() throws Exception { await(); } + @Test + public void testMaxHaderListSize() throws Exception { + server.close(); + server = vertx.createHttpServer(createBaseServerOptions().setInitialSettings(new Http2Settings().setMaxHeaderListSize(Integer.MAX_VALUE))); + server.requestHandler(req -> { + req.response().end(); + }); + startServer(testAddress); + client.request(new RequestOptions(requestOptions).setTimeout(10000)) + .compose(HttpClientRequest::send) + .onComplete(onSuccess(resp -> { + assertEquals(Integer.MAX_VALUE, resp.request().connection().remoteSettings().getMaxHeaderListSize()); + testComplete(); + })); + await(); + } + @Test public void testFoo() throws Exception { waitFor(2);