Skip to content
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

HTTP2 loopback server WaitForCancellationAsync should validate error code sent #59313

Merged
merged 3 commits into from
Nov 2, 2021

Conversation

pedrobsaila
Copy link
Contributor

@pedrobsaila pedrobsaila commented Sep 19, 2021

Fixes #58235

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Sep 19, 2021
@ghost
Copy link

ghost commented Sep 19, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Issue #58235

Author: pedrobsaila
Assignees: -
Labels:

area-System.Net.Http, community-contribution

Milestone: -

@@ -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));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} while (frame.Type != FrameType.RstStream || (frame is RstStreamFrame rstStreamFrame && rstStreamFrame.ErrorCode != 0x8));
} while (frame.Type != FrameType.RstStream || (frame is RstStreamFrame rstStreamFrame && rstStreamFrame.ErrorCode != ProtocolErrors.CANCEL));

I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ErrorCode property is an int, so I casted the enum

@karelz karelz added this to the 7.0.0 milestone Sep 30, 2021
@@ -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 != (int)ProtocolErrors.CANCEL));
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not receive any RstStream frame other than one containing the CANCEL.

As written, this will just ignore a RstStream that doesn't contain CANCEL.

Copy link
Member

Choose a reason for hiding this comment

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

So we should rather just assert that the error code is CANCEL, is that what you mean @geoffkizer?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

@karelz
Copy link
Member

karelz commented Nov 2, 2021

Unrelated test failures:

@karelz karelz merged commit 176e393 into dotnet:main Nov 2, 2021
@karelz
Copy link
Member

karelz commented Nov 2, 2021

Thanks for your PR @pedrobsaila!

@pedrobsaila pedrobsaila deleted the 58235/checkErrorCode branch November 2, 2021 15:57
@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP2 loopback server WaitForCancellationAsync should validate error code sent
4 participants