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

CHANGELOG doesn't explain what happened to hyper::Client or HttpConnector #3450

Open
simbleau opened this issue Nov 29, 2023 · 8 comments
Open
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@simbleau
Copy link

Version
1.0

Description
It's pretty much impossible to update hyper/http to 1.0 for some complex projects that relied heavily on the implementation of Client/HttpConnector since it's not documented how to replace the functionality in the CHANGELOG.

See awslabs/aws-lambda-rust-runtime#737 + awslabs/aws-lambda-rust-runtime#740

@simbleau simbleau added the C-bug Category: bug. Something is wrong. This is bad! label Nov 29, 2023
@WhyNotHugo
Copy link

The documentation still refers to the Client type even though it's gone: https://docs.rs/hyper/1.0.1/hyper/client/conn/index.html

I've been trying to upgrade libdav (a caldav/carddav client) to hyper 1.0. The client in hyper_util::client::legacy::Client is quite different. It needs a generic Body type, which won't work for code that sends requests with different Body implementations.

I'm unsure what to do. The new client is labeled "legacy", and I'd need a non-trivial amount of redesign to integrate with it. Are there plans to introduce a new Client type? I'm trying to decide if I should redesign my entire code around the new Client in hyper_util, or if it's best to wait for for a new Client implementation.

@sfackler
Copy link
Contributor

The 0.14 client also has a generic body type.

@WhyNotHugo
Copy link

True, it did. The default for 0.14 worked for me with both Body::from(String) and Body::empty(), but now empty is Empty::new(), which is a different type. I'm not yet sure what I'd use in place of Body::from(String).

@WhyNotHugo
Copy link

WhyNotHugo commented Nov 29, 2023

I think that my main point of confusion is due to:

rename Body struct to Incoming

It's not immediately obvious what should be used in its place.

@simbleau For Client and HttpConnector you need:

hyper-util = { version = "0.1.1", features = ["client", "client-legacy", "http1"] }

@WhyNotHugo
Copy link

The CHANGELOG mentions that client::connect was dropped and links to 5e20688, which points to the new crate.

@simbleau
Copy link
Author

The CHANGELOG mentions that client::connect was dropped and links to 5e20688, which points to the new crate.

This is very helpful... Let me see if I hit another brick wall.

+1!

@seanmonstar
Copy link
Member

There's also https://hyper.rs/guides/1/upgrading/, which while a bit bare, tries to gather all the pain points that the CHANGELOG doesn't seem to address. Anything specific that is hard to find, we can add to that guide.

@allan2
Copy link
Contributor

allan2 commented Dec 4, 2023

It would be nice if it were mentioned that HttpConnector implements tower_service::Service<Uri> in 1.0 instead of hyper::service::Service<Uri> in 0.14.

It was easy for me to miss this when converting IO traits from Tower to hyper. I wasn't expecting it to go the other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

No branches or pull requests

6 participants
@seanmonstar @WhyNotHugo @sfackler @allan2 @simbleau and others