Skip to content

Commit 632b241

Browse files
authored
HTTP/2: Verify malformed request doesn't reach request delegate (#34374)
1 parent 84b62ce commit 632b241

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,13 +967,23 @@ public async Task ContentLength_Received_NoDataFrames_Reset()
967967
new KeyValuePair<string, string>(HeaderNames.Scheme, "http"),
968968
new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"),
969969
};
970-
await InitializeConnectionAsync(_noopApplication);
970+
971+
var requestDelegateCalled = false;
972+
await InitializeConnectionAsync(c =>
973+
{
974+
// Bad content-length + end stream means the request delegate
975+
// is never called by the server.
976+
requestDelegateCalled = true;
977+
return Task.CompletedTask;
978+
});
971979

972980
await StartStreamAsync(1, headers, endStream: true);
973981

974982
await WaitForStreamErrorAsync(1, Http2ErrorCode.PROTOCOL_ERROR, CoreStrings.Http2StreamErrorLessDataThanLength);
975983

976984
await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false);
985+
986+
Assert.False(requestDelegateCalled);
977987
}
978988

979989
[Fact]

0 commit comments

Comments
 (0)