Skip to content

fix(http1): avoid adding close to switching protocols responses - #4248

Merged
seanmonstar merged 1 commit into
hyperium:masterfrom
akasakariko:fix/http1-upgrade-connection-close
Nov 17, 2026
Merged

seanmonstar merged 1 commit into
hyperium:masterfrom
akasakariko:fix/http1-upgrade-connection-close

Conversation

@akasakariko

@akasakariko akasakariko commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes 4244

I fixed it so that Connection close is not attached to the 101 Switching
Protocols response when keep alive is disabled Because when it is 101, rather
than closing it in HTTP, we have to pass the connection as is to the protocol
being upgraded to

Added is_switching_protocols to Http1Transaction, and modified it so that it
does not put the close header when it is 101, the close processing for a normal
final response remains as is Added the Connection close, Upgrade case to the
upgrades_new test, and confirmed that close is not attached

Locally, I have also already confirmed cargo test features full and clippy, and
that ping pong passes with the reproduction code from the Issue

The description, docs, and comments words meant for humans are written by a
human, not by an LLM

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
@seanmonstar

Copy link
Copy Markdown
Member

Thanks for offering to fix a bunch of things, I do appreciate it! I notice you check the box that it was not written by an LLM, but it does look it was. Your profile mentions you use it because of poor English. Can I ask a change?

We don't mind if your English isn't perfect. That's totally fine! But we want to hear you. If you really hate your English writing, you can write out the sentences in Japanese, and then ask an LLM only to directly translate. The problem is that when they are asked to generate a larger write-up, they do a poor robot job. But, your attempt at English is also welcome!

@seanmonstar
seanmonstar merged commit ac3f950 into hyperium:master Nov 17, 2026
24 checks passed
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.

2 participants