This change allows users to bypass the selected DNS resolver for
specific domains. The allows, for example, to make calls to a local TLS
server by rerouting a given domain to 127.0.0.1.
The approach I've taken for the design is to wrap the resolver in an
outer service. This leads to a fair amount of boilerplate code mainly to
be able to explain the typing to the compiler. The actual business logic
is very simple for the number of lines involved.
Closes#561
This implements a conversion from `hyper::Body` to `reqwest::Body`,
which in turn enables converting a `http::Request<hyper::Body>` into
`reqwest::Request` through the existing `TryFrom` implementation.
Fixes#1156.
This adds a new trait, `CookieStore`, which allows for custom
implementations of storage for a client's cookies. After implementing,
you can call `ClientBuilder::cookie_provider` to use it over the
default storage.
The default store is exposed as `Jar`, to ease the most common use case
which is to add a few cookies to the store when creating a client.
Co-authored-by: Patrick Fernie <patrick.fernie@gmail.com>
I also added a simple sanity test to make sure it doesn't override
a `Body` with an actual size. I also double checked that this works
with a project where we are using streams.
Closes#1090
Now, callers have more control over the set of roots.
Note that, due to cargo unification, other dependencies in the
dependency tree might enable rustls-tls-webpki-roots
or rustls-tls.
This will affect connections initiated by code that explicitly
enabled rustls-tls-manual-roots.
So for now, the choice is done once per entire cargo
dependency graph. If people want more precise control
over things, they can add methods that allow controlling
this on a per-connection level. Even if such methods
are available, the *-manual-roots feature will still be
helpful with eliminating the webpki-roots dependency
for those cargo graphs where there is no unification.
The replace_headers method had to be moved since the async_impl module
is not compiled while compiling to wasm. This caused the replace_headers
method to be unavailable. fast_random had to be excluded from the wasm
build to prevent dead code warnings in the wasm target.
Normally hyper is in charge of rejecting non-http URLs, but because
reqwest supports both http and https URLs, it calls enforce_http(false),
disabling hyper's checks.
This adds back a check in reqwest itself, plus a test.
There may still need to be an additional check in connect.rs.
reqwest exposes the “pool_max_idle_per_host” option of hyper’s client
builder. This option used to be called “max_idle_per_host” in the hyper
crate, but it has recently been renamed [1].
This patch renames the reqwest representation of this option to make it
consistent with its name in the hyper crate again.
[1] https://github.com/hyperium/hyper/pull/2142
hyper’s ClientBuilder has an option to define the idle timeout of the
connection pool. As it’s quite useful to be able to modify this value,
this patch extends reqwest’s ClientBuilder to expose that option as
well. The default value of 90 seconds is taken from hyper.