Repository navigation
test(h1): cover the 400 arm that ends a linked backend stream - #1754
Merged
Merged
Conversation
…nfinished request test_h1_trailer_field_limit_exceeded_split_closes_backend (#1719) checked that a follow-up request on the same client connection was served after a 400 for an over-bound trailer section. #1726, merged first, closes the H1 client connection when a response completes before its request was received whole. An over-bound trailer section leaves the request unfinished: its end cannot be found, so no further request can be read from that connection (RFC 9112 §6.3). The close is the intended behaviour, and the follow-up expectation contradicted it, which turned main red. The test now checks that, after the 400, the client connection reads EOF with no further bytes and that a follow-up request reaches no backend. The other checks are unchanged: head and body forwarded, 400 answered, backend connection holding the cut request closed. Since #1726, removing the block of ConnectionH1::readable that ends the backend stream before the 400 no longer turns this test red: the client close tears the backend down too. The test doc says so. The 400 arm of #1719 has no dedicated unit test. CHANGELOG (#1716 entry), kawa_h1/LIFECYCLE.md §2.3 and the 400-arm comment in mux/h1.rs said the client connection stays as persistent as the answer's Connection header; they now say it closes. No runtime change. Follow-up to #1719 and #1726. Signed-off-by: Florentin Dubois <[email protected]>
…er drain test test_h2_graceful_shutdown_completes_large_transfer slept a fixed 200 ms after starting its request and then issued soft_stop, assuming the request had reached the backend. Under load it had not: the worker rightly refused the not-yet-opened connection or stream, and the test failed with a connection-level error (connection refused, broken pipe, connection closed) without ever exercising the in-flight drain it covers. The backend now holds its response (DelayedH2Backend::start_held), the test waits until the request has reached it, issues soft_stop, then releases the 512 KiB response, so the response is still owed when the soft stop is issued at any load. No production code changed. Fixes #1736 Signed-off-by: Florentin Dubois <[email protected]>
#1719 made both Position::Server arms of the parse-error branch in ConnectionH1::readable end the linked backend stream. Only the cut-response arm had a unit test. The 400 arm relied on the e2e test test_h1_trailer_field_limit_exceeded_split_closes_backend, which no longer catches a regression there: since #1726 the client connection closes after a 400 for an unfinished request, and that close tears the backend down too. a_request_error_answered_400_after_linking_ends_the_backend_stream links a pooled mock H1 backend, reads its complete response without starting it on the client's wire, then sends a malformed chunk. It asserts that the stream leaves backend_streams, and that the backend no longer carries it and is Disconnecting, not pooled. Seen red with the 400-arm block removed: "the rejected stream must leave the backend reverse index". Green with it. CHANGELOG: the #1716 entry names the new test. Follow-up to #1719. Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
force-pushed
the
test/h1-400-arm-ends-backend-stream
branch
from
October 1, 2026 11:23
082e805 to
9d568be
Compare
FlorentinDUBOIS
added a commit
that referenced
this pull request
Oct 1, 2026
On an HTTP/1.1 frontend, `ConnectionH1::writable` handled only 100 and 103 from an HTTP/1.1 backend as interim. Any other 1xx (102, or an unassigned 104-199) took the final-response path: the stream was unlinked and the backend returned to the keep-alive pool while its final response was still due. RFC 9110 §15.2 makes every 1xx interim. The 103 arm now covers 102-199, so the stream stays linked and the final response follows on the same backend connection. 100 and 101 keep their own handling. The access-log tag of an interim response on an unlinked stream becomes `H1::Interim`. Tests: `test_h1_interim_102_before_final` and `test_h1_interim_150_before_final` (e2e) send an interim then a 200 on a keep-alive backend, then a second exchange on the same connections. Fixes #1733 Stacked on #1754. Signed-off-by: Florentin Dubois <[email protected]>
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.
Follow-up to #1719.
Problem
#1719 made both
Position::Serverarms of the parse-error branch inConnectionH1::readable(lib/src/protocol/mux/h1.rs) end the linked backend stream. Only the cut-response arm has a unit test. The 400 arm relied on the e2e testtest_h1_trailer_field_limit_exceeded_split_closes_backend, which no longer catches a regression there: since #1726 the client connection closes after a 400 for an unfinished request, and that close tears the backend down too (see #1748).Change
Test only.
a_request_error_answered_400_after_linking_ends_the_backend_streamlinks a pooled mock H1 backend and reads its complete response without starting it on the client's wire, then sends a malformed chunk. It asserts that the request is answered on the client connection, that the stream leavesbackend_streams, and that the backend no longer carries it and isDisconnecting, not pooled. The CHANGELOG #1716 entry names the new test.Test
Red, on a
git archivecopy with the 400-arm block removed:Green, on this branch:
Validation
cargo +nightly fmt --all --checkcargo +1.93.1 clippy --all-features --all-targets --locked -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-depscargo test -p sozu-lib --all-features --lockedcd fuzz && cargo +nightly fuzz buildcheck_doc_citations.py--self-test,--root .,--root . --base origin/main,--audit --root .Stacked on #1739.