Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server::conn::http1::Connection always holds a proto #3018

Merged
merged 2 commits into from
Oct 24, 2022

Conversation

bossmc
Copy link
Contributor

@bossmc bossmc commented Oct 21, 2022

In the recent work to split the server::conn::Http into protocol-specific halves, the author of that change left the inner proto in an Option (and left a comment asking if this was needed any more). This used to be needed as part of the fallback processing (allowing the fallback to take() the HTTP/1 proto and break it into Parts in order to rebuild the HTTP/2 proto).

Now, since we're definitely using HTTP/1 we can just store the proto directly and, in the process delete a bunch of unwrap calls 💯. We need to be able to take the HTTP/1 Connection in a few places (when an UpgradeableConnection is upgraded for example) but we can scope down the places where we have to unwrap an Option that's almost always Some.

I also tidied up a few instances of dead code (some are feature-specific) which I ran into when running cargo test over this change.

Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up! <3

src/server/conn/http1.rs Outdated Show resolved Hide resolved
@seanmonstar seanmonstar merged commit 91e83b7 into hyperium:master Oct 24, 2022
@bossmc bossmc deleted the http1-conn-infallibility branch November 3, 2022 00:59
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