Skip to content

Conversation

@MihaZupan
Copy link
Member

We can write directly into the final header collection, no need for the List in between.
We already do the same with HTTP/2.

@MihaZupan MihaZupan added this to the 11.0.0 milestone Dec 20, 2025
@MihaZupan MihaZupan self-assigned this Dec 20, 2025
Copilot AI review requested due to automatic review settings December 20, 2025 15:55
@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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes HTTP/3 trailing header processing by eliminating an intermediate List<(HeaderDescriptor, string)> allocation. Instead, trailing headers are written directly into an HttpResponseHeaders instance, matching the pattern already used in HTTP/2.

Key changes:

  • Changed _trailingHeaders field type from List<(HeaderDescriptor, string)>? to HttpResponseHeaders?
  • Simplified CopyTrailersToResponseMessage to use StoreReceivedTrailingHeaders API
  • Updated header addition logic to call TryAddWithoutValidation directly on the headers collection

Copy link
Member

@rzikm rzikm left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants