fix(proxy): ignore empty body payloads in HTTP/1 upstream writes - #976
Open
Curious-r wants to merge 1 commit into
Open
fix(proxy): ignore empty body payloads in HTTP/1 upstream writes#976Curious-r wants to merge 1 commit into
Curious-r wants to merge 1 commit into
Conversation
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.
Summary
Fix a spurious HTTP/1 warning when an empty final body task follows a fully written
Content-Lengthbody. The upstream sink now skips empty payloads in bothBodyandUpgradedBody, whilefinish_body()still handles final framing andContent-Lengthvalidation. Non-empty data after the body is finished continues to trigger the warning.Added regression tests for
Content-Lengthand chunked bodies to ensure empty final tasks don't affect wire framing or produce duplicate chunk terminators.Validated with
cargo test -p pingora-proxy --lib,cargo clippy -p pingora-proxy --lib --tests -- -D warnings, andcargo fmt --all -- --check.Background:
When using a Pingora-based reverse proxy for my Matrix homeserver, I noticed that it produced a large number of warnings like:
After enabling DEBUG logging, the warning could be reproduced on normal Matrix federation requests. The relevant sequence was:
This shows that the warning is triggered by an empty body event arriving after the complete
Content-Lengthbody has already been written. Since empty payloads do not carry any data andfinish_body()already handles the end-of-body framing, the empty buffer should be ignored rather than passed towrite_body().