From ca870aae611261ab331b487c91da876bd2c765d3 Mon Sep 17 00:00:00 2001 From: pedrobsaila Date: Sun, 19 Sep 2021 11:27:28 +0200 Subject: [PATCH 1/3] HTTP2 loopback server WaitForCancellationAsync should validate error code sent --- .../Common/tests/System/Net/Http/Http2LoopbackConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs b/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs index 18edaca7a6524..bba78107a493e 100644 --- a/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs +++ b/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs @@ -973,7 +973,7 @@ public override async Task WaitForCancellationAsync(bool ignoreIncomingData = tr { Assert.Equal(FrameType.RstStream, frame.Type); } - } while (frame.Type != FrameType.RstStream); + } while (frame.Type != FrameType.RstStream || (frame is RstStreamFrame rstStreamFrame && rstStreamFrame.ErrorCode != 0x8)); Assert.Equal(streamId, frame.StreamId); } From 903fae675cd4b770be807d2740a993e650e7198d Mon Sep 17 00:00:00 2001 From: pedrobsaila Date: Mon, 20 Sep 2021 01:22:12 +0200 Subject: [PATCH 2/3] replace constant with enum --- .../Common/tests/System/Net/Http/Http2LoopbackConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs b/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs index bba78107a493e..74e46587a8f91 100644 --- a/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs +++ b/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs @@ -973,7 +973,7 @@ public override async Task WaitForCancellationAsync(bool ignoreIncomingData = tr { Assert.Equal(FrameType.RstStream, frame.Type); } - } while (frame.Type != FrameType.RstStream || (frame is RstStreamFrame rstStreamFrame && rstStreamFrame.ErrorCode != 0x8)); + } while (frame.Type != FrameType.RstStream || (frame is RstStreamFrame rstStreamFrame && rstStreamFrame.ErrorCode != (int)ProtocolErrors.CANCEL)); Assert.Equal(streamId, frame.StreamId); } From d124c25c222d569b9e26b67fcfe06fee3754d4ed Mon Sep 17 00:00:00 2001 From: pedrobsaila Date: Thu, 30 Sep 2021 18:34:29 +0200 Subject: [PATCH 3/3] fix remarks 2 --- .../Common/tests/System/Net/Http/Http2LoopbackConnection.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs b/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs index 74e46587a8f91..84bb65b63aac4 100644 --- a/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs +++ b/src/libraries/Common/tests/System/Net/Http/Http2LoopbackConnection.cs @@ -973,9 +973,11 @@ public override async Task WaitForCancellationAsync(bool ignoreIncomingData = tr { Assert.Equal(FrameType.RstStream, frame.Type); } - } while (frame.Type != FrameType.RstStream || (frame is RstStreamFrame rstStreamFrame && rstStreamFrame.ErrorCode != (int)ProtocolErrors.CANCEL)); + } while (frame.Type != FrameType.RstStream); Assert.Equal(streamId, frame.StreamId); + RstStreamFrame rstStreamFrame = Assert.IsType(frame); + Assert.Equal((int)ProtocolErrors.CANCEL, rstStreamFrame.ErrorCode); } } }