Skip to content

fix: propagate response body reader errors to Hyper - #3019

Open
behnam-oneschema wants to merge 1 commit into
rwf2:v0.5from
oneschema:devin/upstream-response-stream-errors
Open

behnam-oneschema wants to merge 1 commit into
rwf2:v0.5from
oneschema:devin/upstream-response-stream-errors

Conversation

@behnam-oneschema

@behnam-oneschema behnam-oneschema commented Nov 11, 2026 •

Copy link
Copy Markdown

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.5 branch.

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 emits hello, 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

  • Response-framing suite: 5 tests passed.
  • Response-framing suite without default features: 3 tests passed.
  • Full Rocket package tests, including doctests: passed.
  • Formatting check: passed.

Clippy remains blocked by a pre-existing clippy::never_loop error, reproduced on the clean upstream base as well as this branch; it is not suppressed or changed here.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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