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

Add HTTP Upgrade support to Response. #1376

Merged
merged 5 commits into from Jul 28, 2022

Conversation

luqmana
Copy link
Contributor

@luqmana luqmana commented Oct 30, 2021

This adds a new method, Response::upgrade, which consumes the given Response and returns a future for a possible HTTP upgrade. On success the future will yield a new type, Upgraded (a thin wrapper around hyper's Upgraded type), which implements AsyncRead/AsyncWrite over the underlying connection.

As part of this, reqwest's Response type now no longer takes apart the original hyper::Response but rather stores it and maps the Body type to Decoder. This along with hyperium/hyper#2680 makes the new upgrade method just a thin wrapper around hyper's.

Copy link
Owner

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

Alrighty, let's go! Thanks for the work, and for continuing to remind me to pay attention.

@seanmonstar seanmonstar merged commit 61474f4 into seanmonstar:master Jul 28, 2022
@luqmana luqmana deleted the http-upgrade branch July 28, 2022 20:27
@luqmana luqmana mentioned this pull request Jul 28, 2022
@Eldeloro1
Copy link

This adds a new method, Response::upgrade, which consumes the given Response and returns a future for a possible HTTP upgrade. On success the future will yield a new type, Upgraded (a thin wrapper around hyper's Upgraded type), which implements AsyncRead/AsyncWrite over the underlying connection.

As part of this, reqwest's Response type now no longer takes apart the original hyper::Response but rather stores it and maps the Body type to Decoder. This along with hyperium/hyper#2680 makes the new upgrade method just a thin wrapper around hyper's.

@luqmana
Copy link
Contributor Author

luqmana commented Sep 2, 2022

Alrighty, let's go! Thanks for the work, and for continuing to remind me to pay attention.

No problem! Is a release scheduled any time soon so we can get a version with this on crates.io?

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.

None yet

3 participants