test: cover cut-off request bodies and http/2 clients - #18
Merged
Merged
Conversation
Owner
Author
|
@codex review, and also report simplification opportunities in the changed code as P1: logic that duplicates an existing helper, dead code, needless indirection or abstraction, and conditionals or loops with a shorter equivalent. Flag one only when the shorter version behaves the same, and show the replacement code. Do not flag style, naming or formatting. |
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.
This adds integration tests for two untested paths: a request body that fails partway through, and HTTP/2 clients on the TLS listener. The proxy code does not change.
Changes
tests/integration/body_failure.rsputs a raw TCP origin behind a real proxy socket. The client stops aContent-Lengthbody or a chunked body partway, or sends a malformed chunk size. The tests assert that the origin never gets a whole request. For a half-close, the client gets a 502. For bad chunk framing, actix closes the connection with no response. After each case,/healthreturns 200.tests/integration/http2.rsuses a hyper client that offers onlyh2through ALPN and checksVersion::HTTP_2on every response. It covers a proxied GET, a 200 KB POST body, a cache MISS then HIT, andX-Forwarded-Proto: httpswithX-Forwarded-Hosttaken from:authority.Connection,Keep-Alive,TE,Upgradeand a field thatConnectionnames. The test requests the response fresh and from the cache. The h2 crate refuses to sendTE: gzip, and actix removes only some of these fields itself.Verification
pump_request_bodythat drops the payload error makes the chunked half-close test fail, because the origin then gets a0\r\n\r\nlast chunk.Content-Lengthtest still passes under that change, because hyper also aborts a body that ends before its declared length. The malformed-chunk test also still passes, because actix drops the handler, which cancels the origin request.tefrom the proxy hop-by-hop list resets the h2 stream. Ignoring the URI authority inClientInfofails theX-Forwarded-Hostassertion.