128 Commits

Author SHA1 Message Date
Matthew Ransley
4ee6bdec9a UTF encoded form 2023-07-05 14:17:53 +01:00
lpraneis
ae2d521664 Add ability to specify multiple IP addresses for resolver overrides (#1622)
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.
2022-09-19 13:53:36 -07:00
Luqman Aden
61474f422c Add HTTP Upgrade support to Response. (#1376) 2022-07-28 13:18:18 -07:00
Sean McArthur
d73d961166 fix blocking client to use request timeout for response body (#1395) 2021-11-30 10:03:54 -08:00
Biagio Festa
8b37ae4b15 Support to rustls 0.20 (#1388) 2021-11-29 12:25:57 -08:00
Jonas Platte
2881354c90 Fix more clippy warnings 2021-08-26 13:42:46 -07:00
Jonas Platte
4be5ec7ffd Replace use of assert_eq with assert
Reported by clippy.
2021-08-26 13:42:46 -07:00
David Leslie
bdc57beabb fix: respect https_only option when redirecting (#1313) 2021-08-02 16:50:15 -07:00
Chris Campbell
8e5af459e5 Allow overriding of DNS resolution to specified IP addresses(#561) (#1277)
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
2021-06-16 14:41:08 -07:00
Mohamed Daahir
8d3e27966c use ZlibDecoder for deflate responses (#1257) 2021-04-26 16:52:29 -07:00
Mohamed Daahir
77ee0df7c5 Support Deflate decoding (#1250) 2021-04-22 10:35:29 -07:00
Markus Westerlind
2940740493 fix: Upgrade to http2 if the server reports that it supports it (#1166)
The test is disabled as the test server does not support TLS currently
but otherwise I'd expect it to pass (tested in another project).
2021-02-10 13:16:22 -08:00
Alexis Mousset
31b11c3f4c Add a tls_built_in_root_certs option for Client (#1150) 2021-01-27 06:39:36 -08:00
messense
a19eb34196 Update to tokio 1.0, bytes 1.0 (#1076)
Co-authored-by: Wim Looman <git@nemo157.com>
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
2020-12-30 09:57:50 -08:00
varoonp123
73990a7a42 Add From<Bytes> for blocking::Body (#1114) 2020-12-15 07:22:44 -08:00
Martin André
541d0c2aba Add https_only() for ClientBuilder (#1102)
Closes #980
2020-12-09 10:40:46 -08:00
Zicklag
3cd9c29b30 Fix system HTTP proxy to send proxy-authorization (#1021)
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.
2020-11-24 10:34:38 -08:00
est31
23aaa0b60e Add a rustls-tls-native-roots feature
Adds an optional cargo feature to load certificates
from the OS native certificate store.
2020-11-19 13:13:36 -08:00
est31
3ea9f92f24 Add rustls-tls-manual-roots feature to allow callers to specify roots
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.
2020-11-19 13:13:36 -08:00
stevelr
4fe07d81cf add ClientBuilder.default_headers() for wasm32 target (#1084) 2020-11-16 13:09:47 -08:00
shuo
e06e19868f Add is_connect on error (#1023)
* error: add is_connect helper function

* test: ensure request_timeout is not connect_timeout

* fmt

* skip err is_connect if target_arch is wasm. rerun checks

Co-authored-by: lishuo <lishuo.03@bytedance.com>
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
2020-09-02 18:07:13 -07:00
fuyu
9e23103371 Fix detection of system proxy from Windows registry (#1005) 2020-08-19 11:38:21 -07:00
Kent Fredric
c6fbbd9181 Disable test_blocking_inside_a_runtime without cfg(debug_assertions)
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
2020-03-09 11:47:57 -07:00
Sean McArthur
c916dc03cc Improve performance of Response::bytes() (#827) 2020-02-27 12:44:04 -08:00
Sean McArthur
2e06108f70 Require the native-tls feature to supply a preconfigured tls (#814) 2020-02-21 12:41:13 -08:00
Nick Lanham
9ab8ab945c add ability to create a client with own tls connector (#809) 2020-02-21 11:39:31 -08:00
EnokMan
f831d62da0 Brotli support (#791) 2020-02-19 12:49:11 -08:00
Sean McArthur
04980689ce Newest rustfmt changes 2020-02-06 10:17:40 -08:00
Konrad Gołuchowski
22fe6566ff Provide request timeout for blocking API (#764) 2020-01-07 12:24:23 -08:00
kodieg
b159963f6c Add request timeout (#761)
Closes #754
2020-01-03 11:25:04 -08:00
Sean McArthur
09e7fe62e3 Don't set User-Agent header by default (#751) 2019-12-23 12:48:11 -08:00
Sean McArthur
24abf2fcbd Separate default-tls and native-tls features (#749)
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.
2019-12-20 13:22:56 -08:00
Sean McArthur
ce43f80d8b Refactor Redirect API (#741)
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
2019-12-16 15:57:09 -08:00
Sean McArthur
7631c0390e Rename 'unstable-stream' feature to 'stream' (#733) 2019-12-10 16:55:53 -08:00
Gleb Pomykalov
0f32c4a01a Update to hyper 0.13 2019-12-10 16:24:05 -08:00
Sean McArthur
7739e03123 Enable "system" proxies by default (#683)
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
2019-10-17 13:32:00 -07:00
Sean McArthur
8583dd2b4c Replace uuid dependency with tiny internal RNG (#679) 2019-10-15 14:54:26 -07:00
Sean McArthur
ebe57e10a3 Put Stream APIs behind unstable-stream feature 2019-09-27 17:00:15 -07:00
Constantin Nickel
24394364eb Make json an optional feature (default off) 2019-09-27 12:27:23 -07:00
Sean McArthur
6413a4349e Update tokio and hyper alphas 2019-09-25 14:19:37 -07:00
Sean McArthur
f71227d968 Make gzip an optional feature (default off) 2019-09-23 15:46:25 -07:00
Sean McArthur
f4100e4148 Rewrite tests with a hyper server instead of raw TCP
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.
2019-09-23 14:06:01 -07:00
Sean McArthur
7e3c1bc461 Make the blocking API an optional feature (default off) 2019-09-18 12:39:02 -07:00
Sean McArthur
0a87d3d7da Make cookies an optional feature (default off) 2019-09-17 16:50:54 -07:00
Sean McArthur
53495e1526 Redesign Error type
- 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.
2019-09-17 14:23:22 -07:00
Constantin Nickel
b1a90eb402 Prune the futures dependencies 2019-09-12 07:52:31 -07:00
Sean McArthur
5356776834 refine async API
- 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`.
2019-09-10 14:06:09 -07:00
Sean McArthur
87a09322d6 Make the async Client default (#626)
The previously default Client is moved to `reqwest::blocking`, while the
async client becomes the main API.

Closes #622
2019-09-09 17:20:51 -07:00
Sean McArthur
ba7b2a754e refactor all to async/await (#617)
Co-authored-by: Danny Browning <danny.browning@protectwise.com>
Co-authored-by: Daniel Eades <danieleades@hotmail.com>
2019-09-06 17:22:56 -07:00
danieleades
cf8944a0f0 cargo fmt (#604)
Run rustfmt and setup CI to check for it.
2019-08-29 09:52:39 -07:00