Inject a custom reqwest::Client #2784
Sebastian Thiel (Byron)
started this conversation in
Feature Proposal
Replies: 1 comment
|
Is there anyway of getting review on seanmonstar/reqwest#3024 ? I feel like it has been ignored... |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary 💡
Support someway of injecting
reqwest::Clientinto gix, could be a builder method, or a global likewith_reqwest_client, similar to how tracing/log does it (shame we don't have context in rustlang!)Motivation 🔦
In cargo-binstall, we put a lot of configuration into
reqwest::Client, including customised dns config.Plus, having two clients means it cannot share the connection pool and dns record cache and dns connection pool.
https://github.com/cargo-bins/cargo-binstall/blob/c0ae9335b22cb4f297cdd1df049cd87bf2aa223f/crates/binstalk-downloader/src/remote.rs#L124
I know that gix use a blocking client and cargo-binstall uses an async one so one could argue sharing is not possible now, but looking at the reqwest blocking client source code it internally wraps an async one, so it should be trivial to add a
TryFromimpl for async client to sync clientOriginally proposed by Jiahao XU (@NobodyXu) in issue #2569.
All reactions