Commit Graph

609 Commits

Author SHA1 Message Date
K.J. Valencik
c4388fcff9 WASM: Add try_clone implementations to Request and RequestBuilder (#1286)
Currently the wasm client does not implement `try_clone` on `Request` or `RequestBuilder` like the blocking and async clients.

This PR adds infallible `try_clone` implementations to the wasm client to improve the API parity.

*Note*: Even though these APIs are infallible on wasm (no streaming bodies), I chose to keep the API identical.
2021-06-14 10:36:56 -07:00
Mohamed Daahir
b48cb4a5aa Add native-tls-alpn feature (#1283) 2021-06-09 17:05:29 -07:00
Jens Reimann
b0af278f78 Implement "default" functions of the trait to fix "insecure" mode (#1259)
Ignoring validation seems broken as some default functions actually do
check. That is fine for the proper TLS validation, but gets in the way
when someone wants to skip TLS validation (e.g. for self-signed
certificates).

This change re-implements these default functions in a way that they
do not check, but return "success" all the time.

Fixes #1210
2021-04-28 17:19:46 -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
42b31600c3 WASM: set RequestCredentials to None by default (#1249)
Closes #1247
2021-04-21 09:42:09 -07:00
bensadiku
18dfac4fe2 Add RequestBuilder::version() method to set HTTP version (#1243)
Closes #1240
2021-04-14 19:03:22 -07:00
Sean McArthur
7afade446c v0.11.3 2021-04-12 15:50:10 -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
xushaodong
1614c5ea64 supports wasm fetch credentials 2021-04-06 12:42:05 -07:00
Sebastian Klähn
c6eb2c4fcb Fix typo in cookies.rs (#1225) 2021-03-23 15:34:17 -07:00
Sean McArthur
dada01ef65 Fix unused lint for tokio's enter guard in blocking::wait (#1223) 2021-03-22 11:26:36 -07:00
Pawan Singh Bisht
544282a0b4 proxy: refactor a collapsible_match (#1214) 2021-03-17 09:51:51 -07:00
Sean McArthur
80999a8963 v0.11.2 2021-03-09 11:05:35 -08: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
Enno Boland
2414042269 replace match ... { } with matches! macro where possible (#1208) 2021-03-08 15:02:45 -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
Ibraheem Ahmed
9fa58e316d Implement IntoUrl for String (#1201)
Also change from blanket impl to improve docs.
2021-03-01 15:50:29 -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
Sean McArthur
8689aa47e0 v0.11.1 2021-02-18 10:41:02 -08:00
Matt Briggs
f5450f534a support http proxy addresses with no scheme
Other implementations (curl and Go) accept HTTPS_PROXY values with no
protocol scheme. When the scheme is not present, http:// is assumed.
For example 192.168.1.1 is interpreted as http://192.168.1.1

This commit adds support for http proxy addresses without a scheme by
retrying the URL parsing mechanisms with http:// prepended.
2021-02-18 10:04:11 -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
Rakshith Ravi
727903f69a Make Request constructor public for wasm environments (#1173)
Closes #1171
2021-02-13 08:19:11 -08: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
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
Sean McArthur
bd9ff9f371 v0.11.0 2021-01-05 10:19:00 -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
Muhammad Hamza
5ee4fe5ab6 Fix documentation line in for wasm Response 2020-12-20 07:27:35 -08:00
varoonp123
73990a7a42 Add From<Bytes> for blocking::Body (#1114) 2020-12-15 07:22:44 -08:00
Sean McArthur
5099192b92 v0.10.10 2020-12-14 14:37:37 -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
Martin André
a2133aec3b blocking: add tcp_keepalive option (#1100) 2020-12-07 07:56:56 -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
Konrad Borowski
e7be3eda04 Make wasm-bindgen-test a dev dependency 2020-11-24 07:04:21 -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
Sean McArthur
b1d498ffa8 v0.10.9 2020-11-19 16:04:32 -08:00
Qing Lei
0bae133b71 Enable brotli for blocking (#1061) 2020-11-19 16:03:34 -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
Taiki Endo
2dec3b725f Remove pin-related unsafe code 2020-11-13 15:12:06 -08:00
stevelr
045d7c7d2f Support Cloudflare workers runtime (#1081) 2020-11-11 10:10:01 -08:00