-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Update shared HPackEncoder #33170
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
Update shared HPackEncoder #33170
Conversation
3857c62 to
b201455
Compare
| namespace System.Net.Http.HPack | ||
| { | ||
| internal class HPackEncoder | ||
| internal static class HPackEncoder |
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.
No more state!
src/libraries/Common/src/System/Net/Http/aspnetcore/Http2/Hpack/HPackEncoder.cs
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| /// <summary>Encodes the status code of a response to the :status field.</summary> | ||
| public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten) |
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 would merge this idea into StatusCodes.ToStatusBytes(). You can have the static arrays there store the pre-encoded version of the full header.
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.
Good idea but I'll leave that for now. It can be a future optimization.
| // | Value String (Length octets) | | ||
| // +-------------------------------+ | ||
|
|
||
| if ((uint)destination.Length >= 3) |
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.
What's the purpose of the cast here?
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 assume it is to eliminate bounds checks. I just copied and pasted this from the method overload that takes a span of alreadys instead of one.
scalablecory
left a comment
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.
looks good, only small comments.
|
Merge please. I don't have permission (I should really figure that out...) |
|
/azp run runtime-libraries outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Failure is unrelated. |
Sync changes from dotnet/aspnetcore#19521