Skip to content

Commit 0f2c15d

Browse files
committed
Revert "Sync shared code from runtime (#57440)"
This reverts commit 6ae0eb3.
1 parent 4a46df1 commit 0f2c15d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ public void DecodesIndexedHeaderField_DynamicTable()
151151
Assert.Equal(_headerValueString, _handler.DecodedHeaders[_headerNameString]);
152152
}
153153

154+
[Fact]
155+
public void DecodesIndexedHeaderField_DynamicTable_ReferencedEntryRemovedOnInsertion()
156+
{
157+
// Pre-populate the dynamic table so we'll have something to reference.
158+
// This entry will have index 62 (0x3E).
159+
_dynamicTable.Insert(_headerNameBytes, _headerValueBytes);
160+
Assert.Equal(1, _dynamicTable.Count);
161+
162+
Assert.InRange(_dynamicTable.MaxSize, 1, _literalHeaderNameBytes.Length); // Assert that our string will be too big
163+
164+
byte[] encoded = (new byte[] { 0x40 | 0x3E }) // Indexing enabled (0x40) | dynamic table (62 = 0x3E) as a 6-integer,
165+
.Concat(_literalHeaderName) // A header value that's too large to fit in the dynamic table
166+
.ToArray();
167+
168+
_decoder.Decode(encoded, endHeaders: true, handler: _handler);
169+
Assert.Equal(0, _dynamicTable.Count); // The large entry caused the table to be wiped
170+
Assert.Equal(_literalHeaderNameString, _handler.DecodedHeaders[_headerNameString]); // but we got the header anyway
171+
}
172+
154173
[Fact]
155174
public void DecodesIndexedHeaderField_OutOfRange_Error()
156175
{

0 commit comments

Comments
 (0)