Commit Graph

221 Commits

Author SHA1 Message Date
Fredrik Enestad
ab49de875e Body from tokio::fs::File (#1360) 2021-10-21 15:23:17 -07:00
Karsten Jeschkies
be8ab7b951 docs: provide basic auth example (#1362) 2021-10-21 15:08:53 -07:00
Dirk Stolle
597833d906 docs/comments: fix some typos (#1346) 2021-10-08 23:34:57 +00: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
Jonas Platte
1be9c34f01 Make ResponseBuilderExt not target-dependent 2021-08-26 13:42:46 -07:00
Jonas Platte
3879694c09 Add TryFrom<Request> for HttpRequest<Option<Body>> 2021-08-26 13:42:46 -07:00
Jan Verbeek
66c1b48167 Add options for specifying the TLS version (#1315) 2021-08-12 09:41:32 -07:00
David Leslie
bdc57beabb fix: respect https_only option when redirecting (#1313) 2021-08-02 16:50:15 -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
nickelc
eee19c5f3c Fix bare url warnings in multipart docs (#1289) 2021-06-22 07:18:46 -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
b48cb4a5aa Add native-tls-alpn feature (#1283) 2021-06-09 17:05:29 -07:00
Mohamed Daahir
8d3e27966c use ZlibDecoder for deflate responses (#1257) 2021-04-26 16:52:29 -07:00
Mark Lodato
b88f309339 Fix small typos in Client docs (#1253) 2021-04-22 10:37:17 -07:00
Mohamed Daahir
77ee0df7c5 Support Deflate decoding (#1250) 2021-04-22 10:35:29 -07:00
bensadiku
18dfac4fe2 Add RequestBuilder::version() method to set HTTP version (#1243)
Closes #1240
2021-04-14 19:03:22 -07:00
Jon Gjengset
7d8c32784e impl From<hyper::Body> for Body (#1236)
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.
2021-04-08 13:21: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
Alexis Mousset
31b11c3f4c Add a tls_built_in_root_certs option for Client (#1150) 2021-01-27 06:39:36 -08:00
nickelc
afed48cafd Make multipart an optional feature (default off) (#1128) 2021-01-04 13:20:17 -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
Corey Farwell
474d9eff9b Document how a RequestBuilder gets constructed (#1097) 2020-12-09 07:17:37 -08:00
Taylor Thomas
2ca0e26cfa feat(multipart): Adds support for manually setting size
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
2020-11-23 11:10:26 -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
Taiki Endo
2dec3b725f Remove pin-related unsafe code 2020-11-13 15:12:06 -08:00
Ngo Iok Ui (Wu Yu Wei)
00fb43b650 Add tcp_keepalive option for ClientBuilder (#1070) 2020-10-29 08:23:01 -07:00
Patrick Lühne
6705b90a15 Fix typo in documentation (#1056)
This fixes a typo with multiple occurrences in the documentation and
rewraps the documentation comments at 80 characters.
2020-10-12 18:04:33 -07:00
Snarpix
dbd887c262 Expose http1_writev config option to user (#1040) 2020-09-18 11:29:07 -07:00
Zac Pullar-Strecker
db24d54097 Add must_use to ClientBuilder & RequestBuilder (#1011) 2020-08-21 08:58:53 -07:00
Jason van den Hurk
83fa93ccaf Make headers method on WASM client for compatibility with async_impl (#991)
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.
2020-08-06 15:07:43 -07:00
Takayuki Maeda
1e6957a4ac Fix clippy warnings (#981)
* refactor: fix clippy warnings

* refactor: fix redundant_closure

* refactor: fix collapsible if

* refactor: remove unnecessary_unwrap
2020-07-27 09:02:47 -07:00
Fabian Franz
7fd6b44cde Issue #956: Take the cookie store write lock only when necessary (#960) 2020-06-26 12:27:23 -07:00
Jacob Hoffman-Andrews
eef504631b Reject non-http, non-https URLs. (#921)
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.
2020-05-29 10:29:40 -07:00
Damien Cuenot
d879d6f6c2 Define authorization headers as sensitive header (#916) 2020-05-22 14:39:55 -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
x1957
0595c04d10 impl TryFrom http::Request (#887) 2020-05-21 09:23:14 -07:00
Lucas
c81eb4ec41 document internal Arc of reqwest::Client (#876) 2020-04-10 11:34:21 -07:00
Sean McArthur
1f834714f0 Enable TCP nodelay by default (#860) 2020-03-25 12:38:29 -07:00