Commit Graph

79 Commits

Author SHA1 Message Date
Luqman Aden
61474f422c Add HTTP Upgrade support to Response. (#1376) 2022-07-28 13:18:18 -07:00
Brian Cook
2a6e012009 Fix Proxy URL parse error handling. (#1539)
* Check for schema during URL parse error handling.  Lots of unit tests.
* Introduce BadScheme; an error source.  Change schema to scheme.  Use BadScheme instead of the error text to determine that a scheme is not present.
2022-05-05 16:23:36 -07:00
cui fliter
6ca5f3e50c docs: fix some typos (#1531)
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-04-25 10:00:01 -07:00
Elliott Clarke
d3ffb27bdb Add URL API to Error
Adds `without_url`, `with_url`, and `url_mut` to `Error`.

Closes #297
2022-01-27 10:41:37 -08:00
Enno Boland
2414042269 replace match ... { } with matches! macro where possible (#1208) 2021-03-08 15:02:45 -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
Tom Hacohen
668e89b78a Error: add functions to check more error types. (#945)
There are functions to check if the error is from an array of different
reasons, but there were no functions to check if the failure was due to
the rest of the possible error reasons. This commit adds though.

Fixes #942
2020-06-13 07:52:02 -07:00
Sean McArthur
e31d5221fe Refactor connect errors to not use io::Error (#782) 2020-01-13 13:29:14 -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
John Gallagher
43f2ff083c Add error to JsValue conversion and example (#691) 2019-10-30 13:30:32 -07:00
Sean McArthur
932defd879 Introduce unstable, incomplete WASM support 2019-09-26 10:01:08 -07:00
Sean McArthur
f71227d968 Make gzip an optional feature (default off) 2019-09-23 15:46:25 -07:00
Sean McArthur
7e3c1bc461 Make the blocking API an optional feature (default off) 2019-09-18 12:39:02 -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
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
Daniel Eades
4bb4149b63 remove unnecessary double-colons 2019-08-16 12:59:55 -07:00
Daniel Eades
06353fbb1a remove deprecated 'try!' macro 2019-08-16 12:59:55 -07:00
Daniel Eades
3ba4b6eadf port all optional features to 2018-edition 2019-08-16 12:59:55 -07:00
Daniel Eades
5dc5162765 update and tidy code 2019-08-16 12:59:55 -07:00
Daniel Eades
86d9cbc66e cargo fix --edition 2019-08-16 12:59:55 -07:00
Sean McArthur
afbd9e644d Improve error message when using blocking Client inside a Future 2019-07-19 11:47:35 -07:00
Sean McArthur
5096e12fa2 Use executor::enter before blocking a thread in wait 2019-06-05 14:41:53 -07:00
Sean McArthur
964d87ce57 Update trait object syntax to use 'dyn' 2019-06-03 13:15:09 -07:00
nirasan
9f22f46e85 Clarify correct specification of dependency on serde (#525)
Closes #494
2019-05-16 10:46:00 -07:00
Sean McArthur
6df910a61c re-add Error::cause() impl 2019-04-25 18:36:31 -07:00
Sean McArthur
29f7fa74cc combine ClientError and ServerError into Status kind 2019-04-25 10:54:55 -07:00
Sean McArthur
45484d8077 implement Error::source() 2019-04-25 10:45:30 -07:00
Sean McArthur
17850942c8 remove some noise from Error debug format 2019-04-25 10:32:53 -07:00
Sean McArthur
e4b91ad201 improve error messages from gzip decoder 2019-04-25 10:28:13 -07:00
Sean McArthur
ce51fe83d6 Add request timeout support to async Client (#501)
Closes #496
2019-04-22 12:43:30 -07:00
Diggory Blake
c45ff29bfb Add support for SOCKS5 proxies, and parsing proxy authorizations from URLs 2019-04-08 11:42:18 -07:00
Sean McArthur
cd0e4b3c2e Add Error::is_timeout() accessor 2019-02-20 15:15:55 -08:00
Sean McArthur
4d221533a2 Switch trust-dns to an off-by-default optional feature 2019-01-11 17:30:10 -08:00
Sean McArthur
23e13304ef Disable trust-dns on Windows
Closes #431
2019-01-11 12:34:03 -08:00
Sean McArthur
b71787be86 refactor DNS resolver construction
- System Conf is read as `ClientBuilder::build()` time, providing the
  error earlier.
- If there is an error reading the resolve system conf, a better error
  is reported.
- Resolver only needs to lock a mutex once to spawn the background task,
  instead of every single `resolve` call.
2019-01-10 12:47:29 -08:00
Sean McArthur
11d7812e88 rename Incompatile error kind to TlsIncompatible 2019-01-04 14:46:58 -08:00
Sean McArthur
0f4055f9ec remove Error::is_runtime_startup accessor 2019-01-03 11:07:09 -08:00
Sean McArthur
3877e8729c add Error::is_runtime_startup() method 2019-01-02 11:12:25 -08:00
Sean McArthur
4df232efad Return an Error instead of panic if sync Client cannot startup runtime.
The timeout is also increased to 10 seconds from 5.

Closes #392
2018-12-26 17:15:58 -08:00
Sean McArthur
c4985674aa remove Inner noise from Error Debug format 2018-12-19 11:23:35 -08:00
Sean McArthur
49d2905011 allow deprecated Error::cause in test 2018-12-17 13:28:57 -08:00
Sean McArthur
11962e36ab allow deprecated on Error::cause 2018-12-17 12:23:30 -08:00
quininer
37039760f8 Add rustls support (#390) 2018-12-17 11:57:43 -08:00
Sean McArthur
97393143a5 put all TLS functionality behind a feature flag
The "Cargo feature" `default-tls`, which is enabled by default, is
added, with all TLS support relying on it. This allows using reqwest but
disabling the `native-tls` dependency, by disabling this feature.

Closes #225
2018-10-29 16:37:25 -07:00
Yannick Heinrich
c4bf420021 Integrate helper functions inside corresponding structs 2018-10-05 11:19:52 -07:00
Sean McArthur
1a513efe39 reduce size of Error 2018-09-19 15:39:32 -07:00
Sean McArthur
2698148743 fix improper handling of request body backpressure
Closes #348
2018-09-19 14:20:12 -07:00