Skip to content

Deduplicate header Separator logic#100179

Merged
MihaZupan merged 1 commit intodotnet:mainfrom
MihaZupan:http-separator
Mar 26, 2024
Merged

Deduplicate header Separator logic#100179
MihaZupan merged 1 commit intodotnet:mainfrom
MihaZupan:http-separator

Conversation

@MihaZupan
Copy link
Member

We have logic like this duplicated in 7 places:

string? separator = null;
if (headerValues.Length > 1)
{
    HttpHeaderParser? parser = header.Key.Parser;
    if (parser != null && parser.SupportsMultipleValues)
    {
        separator = parser.Separator;
    }
    else
    {
        separator = HttpHeaderParser.DefaultSeparator;
    }
}

This PR adds helpers that hide this. I also avoided the overhead of checking SupportsMultipleValues and doing the transcoding on the hot path.

As far as I can tell neither we nor Kestrel are using the HPack/QPack methods I removed which don't accept a value encoding.

@MihaZupan MihaZupan added this to the 9.0.0 milestone Mar 23, 2024
@MihaZupan MihaZupan self-assigned this Mar 23, 2024
@dotnet-policy-service
Copy link
Contributor

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

@MihaZupan MihaZupan requested a review from a team March 25, 2024 10:19
Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM

@MihaZupan MihaZupan merged commit b42c516 into dotnet:main Mar 26, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2024
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.

2 participants