Skip to content

Add HTTP Upgrade support to Response.#1376

Merged
seanmonstar merged 5 commits into
seanmonstar:masterfrom
luqmana:http-upgrade
Jul 28, 2022
Merged

Add HTTP Upgrade support to Response.#1376
seanmonstar merged 5 commits into
seanmonstar:masterfrom
luqmana:http-upgrade

Conversation

@luqmana

@luqmana luqmana commented Oct 30, 2021

Copy link
Copy Markdown
Contributor

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.

Comment thread src/async_impl/upgrade.rs Outdated
Comment thread src/async_impl/upgrade.rs
@luqmana luqmana force-pushed the http-upgrade branch 2 times, most recently from 3f511ca to 56dc927 Compare March 14, 2022 22:48

@seanmonstar seanmonstar left a comment

Copy link
Copy Markdown
Owner

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
Copy Markdown

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

luqmana commented Sep 2, 2022

Copy link
Copy Markdown
Contributor Author

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.

3 participants