Repository navigation
fix: propagate response body reader errors to Hyper - #3019
Open
behnam-oneschema wants to merge 1 commit into
Open
behnam-oneschema wants to merge 1 commit into
behnam-oneschema wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Fixes #3018.
Problem
When a response body reader fails after sending headers and part of the body, Rocket logs the error but drops the body channel without notifying Hyper of the failure. For responses without
Content-Length, clients can interpret this as successful end-of-body and silently accept truncated data.This reproduces over both HTTP/1.1 and HTTP/2 on the current
v0.5branch.Changes
Send the reader error through the response body channel before returning the original error for Rocket's existing logging. This lets Hyper signal an incomplete response instead of treating channel closure as successful EOF.
The channel receives an error preserving the original kind and message; the original error is returned unchanged. If the receiver has already disconnected, failure to send the notification does not replace the reader error.
No public API or dependency changes.
Regression coverage
Adds real-socket tests for HTTP/1.1 and HTTP/2, each with and without
Content-Length. The reader emitshello, waits until the client receives it, then fails. Tests verify that headers and the prefix arrive, but collecting the remaining body fails.Both new protocol tests reproduce the bug before the fix and pass afterward. Existing framing tests remain unchanged.
Validation
Clippy remains blocked by a pre-existing
clippy::never_looperror, reproduced on the clean upstream base as well as this branch; it is not suppressed or changed here.