From 77e3b97f913c50594a0de28946d3e0416edbe86c Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Tue, 27 Mar 2018 11:28:01 -0700 Subject: [PATCH] okhttp: add hpack test for max dynamic table size --- .../grpc/okhttp/internal/framed/HpackTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/okhttp/third_party/okhttp/test/java/io/grpc/okhttp/internal/framed/HpackTest.java b/okhttp/third_party/okhttp/test/java/io/grpc/okhttp/internal/framed/HpackTest.java index e512582e95..143ad5fb62 100644 --- a/okhttp/third_party/okhttp/test/java/io/grpc/okhttp/internal/framed/HpackTest.java +++ b/okhttp/third_party/okhttp/test/java/io/grpc/okhttp/internal/framed/HpackTest.java @@ -92,6 +92,22 @@ public class HpackTest { assertEquals(headerEntries("custom-key", "custom-header"), hpackReader.getAndResetHeaderList()); } + @Test public void setMaxDynamicTableToZeroDoesNotClearHeaderList() throws IOException { + bytesIn.writeByte(0x40); // Literal indexed + bytesIn.writeByte(0x0a); // Literal name (len = 10) + bytesIn.writeUtf8("custom-key"); + + bytesIn.writeByte(0x0d); // Literal value (len = 13) + bytesIn.writeUtf8("custom-header"); + + bytesIn.writeByte(0x20); // Set max table size to 0 + + hpackReader.readHeaders(); + + assertEquals(0, hpackReader.maxDynamicTableByteCount()); + assertEquals(headerEntries("custom-key", "custom-header"), hpackReader.getAndResetHeaderList()); + } + /** Oldest entries are evicted to support newer ones. */ @Test public void testEviction() throws IOException { bytesIn.writeByte(0x40); // Literal indexed