This change allows the `ClientBuilder::resolve_to_addrs` method to accept a
slice of `SocketAddr`s for overriding resolution for a single domain.
Allowing multiple IPs more accurately reflects behavior of `getaddrinfo`
and allows users to rely on hyper's happy eyeballs algorithm to connect
to a host that can accept traffic on IPv4 and IPv6.
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
Previously, HTTP proxies loaded from the system settings were not
respected for non-HTTPS requests. Now the PROXY_AUTHORIZATION header is
supplied on HTTP requests with a system proxy.
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.
As by default, when executing tests with -C opt-level=n where "n"
is greater than 0, debug assertions are disabled, which removes the
panic!() this test is expecting.
With this tweak, tests no longer fail with any choice of -C opt-level,
and additionally, tests still execute correctly if these tests are
compiled with:
-C opt-level=3 -C debug-assertions=yes
Closes: https://github.com/seanmonstar/reqwest/issues/831
To allow for the default-tls to change to a different backend by
default, this adds a new `native-tls` optional feature. Any TLS feature
that was only available using native-tls now requires the `native-tls`
feature to be enabled.
Changed the redirect types to be from the `redirect` module:
- `reqwest::RedirectPolicy` is now `reqwest::redirect::Policy`
- `reqwest::RedirectAttempt` is now `reqwest::redirect::Attempt`
- `reqwest::RedirectAction` is now `reqwest::redirect::Action`
Changed behavior of default policy to no longer check for redirect loops
(loops should still be caught eventually by the maximum limit).
Removed the `too_many_redirects` and `loop_detected` methods from
`Action`.
Added `error` to `Action` that can be passed any error type.
Closes#717
If no proxies are configured for a client, the environment (system) will
be inspected automatically to set up proxies.
Configuring a `Proxy` on a client or calling `no_proxy` will disable the
use of the automatic system proxy.
Closes#403
This makes the tests much less brittle, by not depending on the exact
order of the HTTP headers, nor always requiring to check for every
single header.
- The `Error`'s kind is a now a set of variants depending on the context
of when an error could occur.
- If another error was the cause, it is now always the `source`.
Along with the `is_*` methods, this should help in understanding *when*
a certain error occurred. For example, an error setting the TLS
certificates will return a builder error, with the TLS error as the
source. This should help differentiate from a TLS error that happens
when connecting to a server.
It also makes the internal code less dependent on all the exact
dependencies that can be enabled or disabled.
- Converted `Response::text` and `Response::json` to `async fn`
- Added `Response::bytes` async fn as a counterpat to `text`.
- Added `Response::chunk` async fn to stream chunks of the response body.
- Added `From<Response> for Body` to allow piping a response as a request body.
- Removed `Decoder` from public API
- Removed body accessor methods from `Response`
- Removed `Chunk` type, replaced with `bytes::Bytes`.
- Removed public `impl Stream for Body`.