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

Backport the split client conn modules #3053

Closed
seanmonstar opened this issue Nov 8, 2022 · 7 comments
Closed

Backport the split client conn modules #3053

seanmonstar opened this issue Nov 8, 2022 · 7 comments
Labels
A-client Area: client. C-feature Category: feature. This is adding a new feature. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful. V-0.14.x 0.14.x versions

Comments

@seanmonstar
Copy link
Member

seanmonstar commented Nov 8, 2022

In 1.0, we've split hyper::client::conn::Connection into per-version types. To ease upgrading (see #3052), we can backport the addition of the two modules, hyper::client::conn::{http1, http2}. With them in place, we could then add a deprecation to hyper::client::conn::Connection.

I don't think this will be actually be E-medium in complexity, as it's not adding something that needs many internal changes. But it's not quite easy, since once the files are copied, there might be some confusing errors over internal types that have been renamed.

@seanmonstar seanmonstar added A-client Area: client. C-feature Category: feature. This is adding a new feature. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful. V-0.14.x 0.14.x versions labels Nov 8, 2022
@kxt
Copy link

kxt commented Nov 22, 2022

I've started looking at this, and I'm not quite sure how to go ahead with this backport: the two versions of the conn module both publicly reexport the Body trait from http_body crate, but the 0.14.x code depends on http_body-0.4.5 and the master code depends on http_body-1.0.0-rc1, which is not backwards compatible.

The only way I can see right now is to have both versions of http_body as a dependency, with http_body-1.0.0-rc1 renamed as http_body_backport. Is this something we want to do?

@seanmonstar
Copy link
Member Author

the two versions of the conn module both publicly reexport the Body trait from http_body crate

Do you mean that the bounds for Connection depend on Body? That's fine. I think what I meant in this ticket is not that the new split modules should use a different version of http_body but that the code should look the same as rc1, while using the same dependencies as 0.14.x.

That way, people can prepare to upgrade by making use of hyper::client::conn::http1::Connection (etc), even in 0.14.x, and then upgrading to 1.0 just requires them to change the versions in their Cargo.toml. Does that make sense?

@kxt
Copy link

kxt commented Nov 25, 2022

Yes, thank you for your quick reply!

I'm preparing a POC PR. One thing of note is that I've removed the timer method of hyper::client::conn::http2::Builder. As far as I can tell this is a 1.0 feature, so no existing code relies on it.

I've created some smoke tests for the backported API, but I'm not quite familiar with the tests in hyper, I'm open for suggestions of further tests.

@kxt
Copy link

kxt commented Nov 25, 2022

On a second thought, I might have gotten overly eager with the deprecation in this PR, that patch might be better off in another issue that tackles the deprecations relevant to the 1.0 upgrade in a systematic way.

@seanmonstar
Copy link
Member Author

At the very least, before landing anything into the 0.14.x branch (which I prefer to be always-shippable, in case of needing speedy fixes), should probably come up with the mechanism to opt-in to the backports (as mentioned in #3052): we don't want to make people compile more code than they are using.

(I don't mean making the deprecations opt-in, those probably should be on to nudge people to start preparing for an upgrade.)

@kxt
Copy link

kxt commented Dec 3, 2022

I settled for 1_0-backports for the feature name, as . is not allowed in feature names.

@seanmonstar seanmonstar linked a pull request Dec 21, 2022 that will close this issue
seanmonstar pushed a commit that referenced this issue Mar 2, 2023
This patch backports client/conn/http1 and http2 modules from 1.0 to
ease transition. It allows code still using 0.14.x to switch to the
per-version Connection types available in 1.0.
seanmonstar pushed a commit that referenced this issue Mar 2, 2023
This patch backports client/conn/http1 and http2 modules from 1.0 to
ease transition. It allows code still using 0.14.x to switch to the
per-version Connection types available in 1.0.
seanmonstar pushed a commit that referenced this issue Mar 2, 2023
client::conn::Builder and client:conn:handshake are deprecated as they
are removed in 1.0.

tower_client is updated so it does not use the deprecated API.
seanmonstar pushed a commit that referenced this issue Mar 3, 2023
This patch backports client/conn/http1 and http2 modules from 1.0 to
ease transition. It allows code still using 0.14.x to switch to the
per-version Connection types available in 1.0.
seanmonstar pushed a commit that referenced this issue Mar 6, 2023
This patch backports client/conn/http1 and http2 modules from 1.0 to
ease transition. It allows code still using 0.14.x to switch to the
per-version Connection types available in 1.0.
seanmonstar added a commit that referenced this issue Mar 6, 2023
This patch backports client/conn/http1 and http2 modules from 1.0 to
ease transition. It allows code still using 0.14.x to switch to the
per-version Connection types available in 1.0.

Closes #3053 

Co-authored-by: KOVACS Tamas <ktamas@fastmail.fm>
seanmonstar pushed a commit that referenced this issue Mar 6, 2023
client::conn::Builder and client:conn:handshake are deprecated as they
are removed in 1.0.

tower_client is updated so it does not use the deprecated API.
seanmonstar pushed a commit that referenced this issue Mar 7, 2023
`client::conn::{SendRequest, Connection, Builder, handshake}` are deprecated
as they are removed in 1.0.

tower_client is updated so it does not use the deprecated API.
@seanmonstar
Copy link
Member Author

Completed in #3155. (Deprecation was in #3156.)

oddgrd pushed a commit to oddgrd/hyper that referenced this issue Mar 7, 2023
This patch backports client/conn/http1 and http2 modules from 1.0 to
ease transition. It allows code still using 0.14.x to switch to the
per-version Connection types available in 1.0.

Closes hyperium#3053 

Co-authored-by: KOVACS Tamas <ktamas@fastmail.fm>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-client Area: client. C-feature Category: feature. This is adding a new feature. E-medium Effort: medium. Some knowledge of how hyper internal works would be useful. V-0.14.x 0.14.x versions
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants