Refactor legacy client to be independent of tokio#269
Refactor legacy client to be independent of tokio#269erickt wants to merge 6 commits intohyperium:masterfrom
Conversation
3e14630 to
9f5b854
Compare
Now that hyper-util uses `socket2::Socket::set_tcp_nodelay`, which was added in [0.6.0]. It used to be called `socket2::Socket::set_nodelay` in [0.5.10]. It also updates the MSRV to Rust 1.70 since that's the minimum supported version in socket2 0.6.0. [0.5.10]: https://docs.rs/socket2/0.5.10/socket2/struct.Socket.html#method.set_nodelay [0.6.0]: https://docs.rs/socket2/0.6.0/socket2/struct.Socket.html#method.set_tcp_nodelay
9f5b854 to
22c3809
Compare
|
The hyper-rustls part of this looks okay to me, though it definitely feels like there should be a shorthand for |
07e407c to
06eb653
Compare
06eb653 to
e362823
Compare
|
Whilst I do think this can have it's use for backwards compatibility with older codebase, why not just use the new pooling client? At least: why should a new user decide to use this instead of the pooling client? |
|
@sjcobb2022 - whoops! I didn't notice there was a new pooling client. I'll add support for it. |
|
The new pooling client is already basically generic over an executor. See #243 |
|
@sjcobb2022 - thanks for the reference! From the doctests in #243 it seems like that patch is still dependent on a |
No, but any inner transport could use this, e.g. use a raw tcpstream instead of a httpconnector, or a raw tcpstream wrapped in an sslstream from rustls. The HttpConnecter was used in doctests for simplicity |
This patch decouples the functionality of
client::legacyfrom tokio, by lifting up aClient,HttpConnection, andResolverinto theclientmodule. For backwards compatibility, it reimplementsclient::legacyto be based off of the new code.As best as I can tell it should be backwards compatible, and passes all the tests.
There's a couple of areas where I'm not sure if we got quite the right API:
newmethod.This is an experiment, so I wouldn't be surprised if it needs changes. To test out the design, I also have a WIP branch to update
hyper-rustlsto use the new interface, found in https://github.com/erickt/hyper-rustls/tree/new-client. I'll not push that up as a PR for now to avoid splitting the conversation, but I did want to cc @djc since you might also have opinions about how this should look.Note that I did use AI to help with the refactoring, but I did review the code, and did a lot of the restructuring by hand.
Fixes #3842.