Skip to content

Inject a custom reqwest::Client #2569

@NobodyXu

Description

@NobodyXu

Summary 💡

Support someway of injecting reqwest::Client into gix, could be a builder method, or a global like with_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 TryFrom impl for async client to sync client

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions