Commit Graph

50 Commits

Author SHA1 Message Date
Sean McArthur
d73d961166 fix blocking client to use request timeout for response body (#1395) 2021-11-30 10:03:54 -08:00
niuhuan
161d731892 add resolve to blocking client (#1384) 2021-11-18 16:33:29 -08:00
Jan Verbeek
66c1b48167 Add options for specifying the TLS version (#1315) 2021-08-12 09:41:32 -07:00
Mohamed Daahir
bccefe7486 add option to disable http2 upgrade (#1292)
Co-authored-by: Sean McArthur <sean@seanmonstar.com>
2021-06-24 18:00:06 -07:00
Jan Verbeek
d9308f1b26 Fix documentation of http1_title_case_headers() (#1294)
Case is not preserved either way, so the old text was misleading.
2021-06-24 14:30:53 -07:00
Mohamed Daahir
77ee0df7c5 Support Deflate decoding (#1250) 2021-04-22 10:35:29 -07:00
Sean McArthur
12d7905520 Add CookieStore trait and expose default Jar (#1203)
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>
2021-03-08 15:40:58 -08:00
CfirTsabari
a856638316 Check format to all rs files under src (#1188)
fixed-format of all missing files.
Fixes seanmonstar/reqwest#1186
2021-03-01 17:06:14 -08:00
Sven-Hendrik Haase
ff2381e61e Add http2_adaptive_window and htt2_max_frame_size from hyper (#1194)
Fixes #1193.
2021-02-22 16:37:28 -08:00
nickelc
c27cd06a11 Use doc_cfg to show feature requirements (#1134)
* Use `doc_cfg` to show feature requirements

* Apply suggestions from code review
2021-02-17 16:48:08 -08:00
Sean McArthur
287a6d1852 Lint: fix unused Identity if only using default-tls (#1164) 2021-02-08 14:25:09 -08:00
Mark Hildreth
326b8a7769 Marked sensitive headers as such in docs (#1160) 2021-02-05 11:02:38 -08:00
William Chargin
9ae11b26fc Document that blocking and async do not mix (#1159)
See discussion on #1017. This patch adds documentation to `blocking` at
module level and to its `Client::new` and `ClientBuilder::build`, noting
that you can’t create or use a blocking client from within an async
runtime, and suggesting potential alternatives.

Presumably, all the other methods on `Client` also have this property,
but hitting the failure mode would require building a `blocking::Client`
outside an async runtime and then moving it into a runtime to send
requests; seems potentially not worth polluting all the docs.

Test Plan:
Ran `cargo doc --features blocking` and verified that the links work.

wchargin-branch: docs-blocking-no-async
wchargin-source: 0eb36352959cd2ca0b19df5836e75230dc619b9d
2021-02-05 11:00:11 -08:00
Alexis Mousset
31b11c3f4c Add a tls_built_in_root_certs option for Client (#1150) 2021-01-27 06:39:36 -08:00
Paolo Barbolini
3fb2c1c143 Remove deprecated features (#1124) 2020-12-30 10:24:57 -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
Sean McArthur
46efd05810 Change default tcp_keepalive value to be disabled (#1113) 2020-12-14 13:42:35 -08:00
Martin André
541d0c2aba Add https_only() for ClientBuilder (#1102)
Closes #980
2020-12-09 10:40:46 -08:00
Martin André
a2133aec3b blocking: add tcp_keepalive option (#1100) 2020-12-07 07:56:56 -08:00
Qing Lei
0bae133b71 Enable brotli for blocking (#1061) 2020-11-19 16:03:34 -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
Youngsuk Kim
f012163333 typo fix in docs (#1024) 2020-09-01 14:06:23 -07:00
Zac Pullar-Strecker
db24d54097 Add must_use to ClientBuilder & RequestBuilder (#1011) 2020-08-21 08:58:53 -07:00
Michal 'vorner' Vaner
69288606bc Allow conversion from async client builder to blocking one (#978)
The builders have mostly the same options and the blocking one is just a
wrapper around the async one. The possible conversion makes it easier to
support creating both kinds from configuration file, reducing some code
duplication.
2020-07-20 10:27:14 -07:00
Patrick Lühne
ecf1df572c Rename option to “pool_max_idle_per_host” (#917)
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
2020-05-22 08:05:44 -07:00
Patrick Lühne
b5706f2d89 Make pool idle timeout configurable (#866)
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.
2020-05-22 07:37:02 -07:00
Sean McArthur
1f834714f0 Enable TCP nodelay by default (#860) 2020-03-25 12:38:29 -07:00
daxpedda
c1c2b9dd7b Implement ability to disable trust-dns in ClientBuilder. 2020-03-03 10:54:49 -08:00
Sean McArthur
9a66c5748b Document advanced (brittle) nature of use_preconfigured_tls 2020-02-27 12:47:38 -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
Jack Moffitt
5a2cf97872 Implement Default for Client, ClientBuilder, and Form (#811) 2020-02-19 22:02:49 -08:00
Sean McArthur
50c33a932e Add connection_verbose setting to log IO events (#774) 2020-01-09 13:42:01 -08:00
Konrad Gołuchowski
22fe6566ff Provide request timeout for blocking API (#764) 2020-01-07 12:24:23 -08:00
Sean McArthur
1f44638ec7 Add logs around blocking runtime shutdown 2020-01-02 11:03:22 -08:00
Sean McArthur
09e7fe62e3 Don't set User-Agent header by default (#751) 2019-12-23 12:48:11 -08:00
Sean McArthur
47734f55f4 Replace futures-channel with tokio::sync in blocking client (#748) 2019-12-23 12:01:23 -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
Gleb Pomykalov
0f32c4a01a Update to hyper 0.13 2019-12-10 16:24:05 -08:00
Kyle Huey
6433db78b1 Add http2 window setters to ClientBuilder (#659) 2019-10-17 15:01:37 -07: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
6b5726aaa8 Improve fmt::Debug of Client and ClientBuilder 2019-10-09 13:46:39 -07:00
Sean McArthur
bb3d672cd8 re-organize builder methods for docs purposes 2019-10-03 14:42:15 -07:00
Sean McArthur
f71227d968 Make gzip an optional feature (default off) 2019-09-23 15:46:25 -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
SOFe
23e8a4d58e Fixed incorrect description of ClientBuilder::gzip
"inflate" actually means decompress in the context of DEFLATE. "deflate" reduces the size of something, i.e. compression, and inflate is the opposite, i.e. decompression.
2019-09-13 11:24:23 -07:00
Constantin Nickel
b1a90eb402 Prune the futures dependencies 2019-09-12 07:52:31 -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