Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Mar 4, 2020

Sync changes from dotnet/aspnetcore#19521

@JamesNK JamesNK force-pushed the jamesnk/hpackshared-sync branch from 3857c62 to b201455 Compare March 4, 2020 20:43
@JamesNK
Copy link
Member Author

JamesNK commented Mar 4, 2020

// @Tratcher @scalablecory

namespace System.Net.Http.HPack
{
internal class HPackEncoder
internal static class HPackEncoder
Copy link
Member Author

Choose a reason for hiding this comment

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

No more state!

}

/// <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)
Copy link
Contributor

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.

Copy link
Member Author

@JamesNK JamesNK Mar 5, 2020

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)
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

@scalablecory scalablecory left a 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.

@JamesNK
Copy link
Member Author

JamesNK commented Mar 5, 2020

Merge please. I don't have permission (I should really figure that out...)

@scalablecory
Copy link
Contributor

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scalablecory
Copy link
Contributor

Failure is unrelated.

@scalablecory scalablecory merged commit 08565e9 into dotnet:master Mar 5, 2020
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants