Skip to content

Sync shared code from runtime #57440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,6 @@ public void DecodesIndexedHeaderField_DynamicTable()
Assert.Equal(_headerValueString, _handler.DecodedHeaders[_headerNameString]);
}

[Fact]
public void DecodesIndexedHeaderField_DynamicTable_ReferencedEntryRemovedOnInsertion()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amcasey just added this test in #57221. It should have been sync'd the other way - to dotnet/runtime.

@amcasey - would it be better if you first added tests like this to dotnet/runtime, and then let the code flow to aspnetcore?

cc @Tratcher - is this the preferred way to add tests to these shared files?

{
// Pre-populate the dynamic table so we'll have something to reference.
// This entry will have index 62 (0x3E).
_dynamicTable.Insert(_headerNameBytes, _headerValueBytes);
Assert.Equal(1, _dynamicTable.Count);

Assert.InRange(_dynamicTable.MaxSize, 1, _literalHeaderNameBytes.Length); // Assert that our string will be too big

byte[] encoded = (new byte[] { 0x40 | 0x3E }) // Indexing enabled (0x40) | dynamic table (62 = 0x3E) as a 6-integer,
.Concat(_literalHeaderName) // A header value that's too large to fit in the dynamic table
.ToArray();

_decoder.Decode(encoded, endHeaders: true, handler: _handler);
Assert.Equal(0, _dynamicTable.Count); // The large entry caused the table to be wiped
Assert.Equal(_literalHeaderNameString, _handler.DecodedHeaders[_headerNameString]); // but we got the header anyway
}

[Fact]
public void DecodesIndexedHeaderField_OutOfRange_Error()
{
Expand Down
Loading