-
Notifications
You must be signed in to change notification settings - Fork 10k
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
HTTP/3 input validation and connection abort #29665
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
58f0725
Connection error for invalid HTTP/3 frame on request stream
JamesNK d157b35
Update src/Servers/Kestrel/Core/src/CoreStrings.resx
JamesNK 17a98cd
Write frame types and errors codes in logs as per spec
JamesNK 31373aa
Clean up
JamesNK ff298ab
Add HTTP/3 connection exception with code
JamesNK b38e627
Connection abort
JamesNK 36598cd
More abort connection stuff
JamesNK 701c04e
More test
JamesNK 5e5a3f6
More tests
JamesNK 0ceb9fd
PR feedback
JamesNK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Servers/Kestrel/Core/src/Internal/Http3/Http3ConnectionErrorException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Net.Http; | ||
|
||
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3 | ||
{ | ||
internal class Http3ConnectionErrorException : Exception | ||
{ | ||
public Http3ConnectionErrorException(string message, Http3ErrorCode errorCode) | ||
: base($"HTTP/3 connection error ({errorCode}): {message}") | ||
{ | ||
ErrorCode = errorCode; | ||
} | ||
|
||
public Http3ErrorCode ErrorCode { get; } | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
src/Servers/Kestrel/Core/src/Internal/Http3/Http3ConnectionException.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hated this approach when I added it. Maybe better to expose an exception type in the transport that has an error code on it? Then when we call abort, the error code will be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception would have to be in connection abstractions so Kestrel can throw it and the QUIC transport can read it.
Looking at where
IProtocolErrorCodeFeature
is used,ConnectionAbortedException
would be a good place to add along? ProtocolError { get; }
property. How come a feature was used instead?@davidfowl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also prefer the protocol error being an argument to abort rather than a property that's set beforehand. What if we made a
QuicConnectionAbortedException
with aProtocolError
property and do anas
check inQuicConnectionContext.Abort(ConnectionAbortedException)
? I think I prefer that slightly to just adding the property directly toConnectionAbortedException
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I didn't want to modify ConnectionAbortedException I believe at the time.