From 94c2649d7b393a4d8df928487358df9fcc8a6aa8 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sun, 28 May 2023 00:38:43 +0200 Subject: [PATCH] Fixed default table size for the HpackDecoder. This is necessary because the remote encoder may encode fields assuming that the default size is 4096, and never send the table resize instruction. In this case, the decoder table cannot start at zero, it must start at the default of 4096. Signed-off-by: Simone Bordet --- .../main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java | 2 +- .../java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java index 14f77d9e5d9..54017a6c81b 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java @@ -50,7 +50,7 @@ public class HpackDecoder */ public HpackDecoder(int maxHeaderSize) { - _context = new HpackContext(0); + _context = new HpackContext(HpackContext.DEFAULT_MAX_TABLE_CAPACITY); _builder = new MetaDataBuilder(maxHeaderSize); _huffmanDecoder = new HuffmanDecoder(); _integerDecoder = new NBitIntegerDecoder(); diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java index 87ad45bf234..591775f84c8 100644 --- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java +++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java @@ -58,8 +58,6 @@ public class HpackDecoderTest public void testDecodeD3() throws Exception { HpackDecoder decoder = new HpackDecoder(8192); - decoder.setMaxTableCapacity(HpackContext.DEFAULT_MAX_TABLE_CAPACITY); - decoder.getHpackContext().resize(decoder.getMaxTableCapacity()); // First request String encoded = "828684410f7777772e6578616d706c652e636f6d"; @@ -108,8 +106,6 @@ public class HpackDecoderTest public void testDecodeD4() throws Exception { HpackDecoder decoder = new HpackDecoder(8192); - decoder.setMaxTableCapacity(HpackContext.DEFAULT_MAX_TABLE_CAPACITY); - decoder.getHpackContext().resize(decoder.getMaxTableCapacity()); // First request String encoded = "828684418cf1e3c2e5f23a6ba0ab90f4ff";