Skip to content

Fix HTTP/2 bodyless requests failing after a complete response - #7552

Open
crliao wants to merge 2 commits into
aws:masterfrom
crliao:aws-fix-h2-bodyless-endstream
Open

crliao wants to merge 2 commits into
aws:masterfrom
crliao:aws-fix-h2-bodyless-endstream

Conversation

@crliao

@crliao crliao commented Nov 13, 2026 •

Copy link
Copy Markdown

Motivation and Context

  • A request with no body is sent over HTTP/2 as a HEADERS frame followed by an empty DATA frame that ends the stream.
  • The server can send its full response and then reset the stream with RST_STREAM NO_ERROR before that empty DATA frame goes out. RFC 9113 §8.1 allows this.
  • The client then fails a request whose response it already received.

Modifications

  • HttpToHttp2OutboundAdapter: bodyless requests now end the stream on the HEADERS frame, so no empty DATA frame is sent.
  • NettyRequestExecutor: a write failure that happens after the response has already completed successfully is now ignored.
  • Existing tests were updated to expect END_STREAM on HEADERS: H2ServerErrorTest, PingTimeoutTest, ServerCloseConnectionTest, ServerNotRespondingTest, WindowSizeTest and HttpToHttp2OutboundAdapterTest.
  • New EarlyResponseResetTest with 14 cases.
  • A changelog entry was added under .changes/next-release.

Testing

  • The netty-nio-client module builds and its test suite passes on the branch, including the 14 new tests.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance improvement (non-breaking change which improves latency, throughput, or resource use)
  • Deprecation (marks existing functionality as deprecated)
  • Removal (removes previously deprecated functionality)
  • Documentation (changes to documentation only)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

AI tools

  • I wrote this pull request description myself, not with an AI tool
  • I have reviewed all changes in this pull request myself, including any generated by AI tools

License

  • I confirm that this pull request can be released under the Apache 2 license

crliao and others added 2 commits November 13, 2026 12:59
For HTTP/2 requests without a body, send HEADERS with END_STREAM instead
of HEADERS followed by an empty DATA(END_STREAM) frame. A server may
respond and reset the stream (RST_STREAM NO_ERROR, RFC 9113 section 8.1)
before the trailing DATA frame is written, which previously failed a
request whose response had already been received. Also ignore request
write failures that happen after the response completed successfully.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant