Repository navigation
fix(http1): avoid adding close to switching protocols responses - #4248
Open
akasakariko wants to merge 1 commit into
Open
akasakariko wants to merge 1 commit into
akasakariko wants to merge 1 commit into
Conversation
Do not append Connection: close to an HTTP/1.1 101 response when HTTP keep-alive is disabled The connection is handed off to the upgraded protocol rather than closed Extend the existing upgrade test to cover a request with Connection: close, Upgrade Verify the response headers while retaining the buffered-byte and upgraded-I/O checks Fixes hyperium#4244
This branch has not been deployed
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.
Fixes #4244
Summary
Do not append
Connection: closeto an HTTP/1.1101 Switching Protocolsresponse when HTTP keep-alive is disabledThe connection is handed off to the upgraded protocol rather than closed by HTTP
is_switching_protocolspredicate to the internalHttp1Transactiontraitcloseinto the HTTP/1.1 response headers when replying with status 101upgrades_newtest withConnection: close, Upgradeto assertconnection: upgradewithoutclosewhile retaining buffered data and upgraded stream checksLocal validation
cargo test --features full --test server upgrades_new -- --exactfails on baseline and passes with this fixcargo test --features full(328 passed, 0 failed, 10 ignored)cargo +1.99.1 clippy --features full -- -D warningspassed without warningsrustfmt --check --edition 2021 $(git ls-files '*.rs')andgit diff --checkpassedRUSTFLAGS='-D dead_code -D unused_imports' cargo hack --no-dev-deps check --feature-powerset --depth 2 --skip ffi,tracing(all 33 passed)RUSTFLAGS='--cfg hyper_unstable_tracing -D dead_code -D unused_imports' cargo hack --no-dev-deps check --feature-powerset --depth 2 --features tracing --skip ffi(all 33 passed)RUSTFLAGS='--cfg hyper_unstable_ffi' cargo test --features client,http1,http2,ffi --lib(104 passed, 6 ignored)cargo semver-checks check-release --baseline-rev b07337878fe57b34b2065335ae8cae9ce5a780a0 --only-explicit-features --features full(223 passed, 31 skipped)Rust 1.63 consumer check with MSRV-resolved vendored dependencies passed
Issue gist reproducer and raw-probe test passed with
connection: upgradeand successful ping/pongThe description, docs, and comments (words meant for humans) are written by a human, not by an LLM.