Skip to content

fix(http2/3): add trailer headers timeout#66249

Merged
DeagleGross merged 6 commits intodotnet:mainfrom
DeagleGross:dmkorolev/sec/http2-headertrailers-timeout
Apr 23, 2026
Merged

fix(http2/3): add trailer headers timeout#66249
DeagleGross merged 6 commits intodotnet:mainfrom
DeagleGross:dmkorolev/sec/http2-headertrailers-timeout

Conversation

@DeagleGross
Copy link
Copy Markdown
Member

@DeagleGross DeagleGross commented Apr 9, 2026

Fixing handling of HTTP/2 trailer header timeouts in Kestrel by ensuring that fragmented trailer HEADERS frames (those missing END_HEADERS) correctly arm and enforce the RequestHeadersTimeout, preventing connections from hanging indefinitely.

same for http/3

@DeagleGross DeagleGross self-assigned this Apr 9, 2026
Copilot AI review requested due to automatic review settings April 9, 2026 15:24
@DeagleGross DeagleGross added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Apr 9, 2026
Copy link
Copy Markdown
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 fixes HTTP/2 trailer header timeout handling in Kestrel so that fragmented trailer HEADERS blocks (missing END_HEADERS) correctly arm/enforce RequestHeadersTimeout, avoiding connections that can hang indefinitely waiting for a final CONTINUATION frame.

Changes:

  • Arm RequestHeadersTimeout when receiving fragmented trailer HEADERS (no END_HEADERS) and cancel it when the trailer header block completes.
  • Add functional tests covering trailer HEADERS timeout enforcement and cancellation scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs Arms/cancels RequestHeadersTimeout for fragmented trailer HEADERS/CONTINUATION sequences.
src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs Adds new HTTP/2 timeout tests specifically for fragmented trailer header blocks.

Comment thread src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs Outdated
Copy link
Copy Markdown
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

I thought we already did this

@halter73
Copy link
Copy Markdown
Member

I think the HTTP/3 changes look good too. 👍

@DeagleGross DeagleGross merged commit c7950fb into dotnet:main Apr 23, 2026
31 checks passed
@DeagleGross DeagleGross deleted the dmkorolev/sec/http2-headertrailers-timeout branch April 23, 2026 10:24
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 23, 2026
@wtgodbe wtgodbe modified the milestones: 11.0-preview4, 11.0-preview5 Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants