Skip to content

Commit 5980890

Browse files
committed
okhttp: add hpack test for max dynamic table size
1 parent 25d9e5f commit 5980890

File tree

1 file changed

+16
-0
lines changed
  • okhttp/third_party/okhttp/test/java/io/grpc/okhttp/internal/framed

1 file changed

+16
-0
lines changed

okhttp/third_party/okhttp/test/java/io/grpc/okhttp/internal/framed/HpackTest.java

+16
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ private static List<Header> headerEntries(String... elements) {
9292
assertEquals(headerEntries("custom-key", "custom-header"), hpackReader.getAndResetHeaderList());
9393
}
9494

95+
@Test public void setMaxDynamicTableToZeroDoesNotClearHeaderList() throws IOException {
96+
bytesIn.writeByte(0x40); // Literal indexed
97+
bytesIn.writeByte(0x0a); // Literal name (len = 10)
98+
bytesIn.writeUtf8("custom-key");
99+
100+
bytesIn.writeByte(0x0d); // Literal value (len = 13)
101+
bytesIn.writeUtf8("custom-header");
102+
103+
bytesIn.writeByte(0x20); // Set max table size to 0
104+
105+
hpackReader.readHeaders();
106+
107+
assertEquals(0, hpackReader.maxDynamicTableByteCount());
108+
assertEquals(headerEntries("custom-key", "custom-header"), hpackReader.getAndResetHeaderList());
109+
}
110+
95111
/** Oldest entries are evicted to support newer ones. */
96112
@Test public void testEviction() throws IOException {
97113
bytesIn.writeByte(0x40); // Literal indexed

0 commit comments

Comments
 (0)