-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Move HTTP upgrades API off the Body type #2086
Comments
Just my 2¢, and I don't know how you or others would feel about it, but at this early stage it should be fine IMO to just release a 0.14 with it changed to the way you believe it should be. I suspect that only a few of us users have gone far upgrading to 0.13 yet and and its just another version to bump in our Cargo.toml. Said from the opposite direction a quick 0.14 turnover is less concerning than breaking changes in 0.13.4 or whatever. Maybe 0.13 just wasn't your lucky number? If I had managed to release anything with an "^0.13" dependency already I might feel a little different, but not much. |
A related question: should any of this updated API actually go in the http crate? |
Should support for intermediate 1xx responses also be added? https://tools.ietf.org/html/rfc7231#section-6.2 This could be useful for 103: Early Hints, or something else added in the future. |
Closes #2086 BREAKING CHANGE: The method `Body::on_upgrade()` is gone. It is essentially replaced with `hyper::upgrade::on(msg)`.
…2337) Closes hyperium#2086 BREAKING CHANGE: The method `Body::on_upgrade()` is gone. It is essentially replaced with `hyper::upgrade::on(msg)`.
Introduced in #1563, the HTTP Upgrade/
CONNECT
API currently is accessed viahyper::Body::on_upgrade
. This has some downsides that I'd like to address with a modified API:Body
type fatter.Body
around, meaning they can't use stream combinators to read the body first, and then wait for the upgrade to finish. This also makes it more annoying for users who may wish adjust theirhttp::Request<Body>
into somehttp::Request<Doodad>
.Proposed API
Similar to the proposal in #1586, the change would be to pass the
http::Request
orhttp::Response
to a free function.hyper::upgrade::on(req_or_resp) -> OnUpgrade
has_upgrade
, etc.Implementation Plan
The types would be inserted into the
http::Extensions
of the request/response (though with a private wrapper type to hide the exact details).hyper::upgrade::on
function.Body::on_upgrade
method would become#[deprecated]
.OnUpgrade
would need to be placed in both theBody
and theExtensions
, wrapped in someArc<Lock>
that only allows taking it once.I'd like to in a future release be able to not put it in an
Arc<Lock>
and place it in theBody
, but I'm not sure how that could really be done in 0.13.x. (I knew I'd find something I forgot to change after finally releasing XD).The text was updated successfully, but these errors were encountered: