Commit Graph

92 Commits

Author SHA1 Message Date
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
Bas De Bue
81e0f1ff2a Change Part::stream to reqwest::r#async::Chunk 2019-08-21 13:06:49 -07:00
Luca Bruno
8027a2894a tests: add more badssl tests for rustls 2019-08-20 14:05:34 -07:00
Daniel Eades
4bb4149b63 remove unnecessary double-colons 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
86d9cbc66e cargo fix --edition 2019-08-16 12:59:55 -07:00
WindSoilder
577d06c363 Add support for system/environment proxies (#547) 2019-07-01 16:27:58 -07:00
messense
564a08f230 Add Response::json() test cases 2019-06-26 11:11:07 -07:00
messense
c5f2bf6c32 Add Response::text() to async Client 2019-06-26 11:11:07 -07:00
messense
a3cd3633d8 Use dyn Trait feature in examples & tests (#553) 2019-06-25 21:16:20 -07:00
Dmitry Pankratov
e16aed5e3c Added support for sending requests with streaming Body (#545) 2019-06-14 10:29:54 -07:00
prfss
c7da30149a Fix cookie header to not include set-cookie attributes (#522) 2019-05-15 13:12:22 -07:00
WindSoilder
e0a52dcf5d Include new cookie header after a redirect (#514)
Closes #510
2019-04-30 15:15:41 -07:00
Sean McArthur
f6ce085457 Propagate async timeout to response body (#503) 2019-04-22 15:24:35 -07:00
Sean McArthur
ce51fe83d6 Add request timeout support to async Client (#501)
Closes #496
2019-04-22 12:43:30 -07:00
Jerome Gravel-Niquet
77434a29aa Fix overwriting of appended request headers (#493)
* don't overwrite appended user headers

* Fixes tests, all header ordering related

* does not need to clone default headers, added a test
2019-04-15 12:33:03 -07:00
Christoph Herzog
9935a8e117 CookieStore cleanup/fixes
* Remove TODO
* Remove Cookie::set_ setters
* Do not expose SameSite enum, provide getters on Cookie instead
* Simplify Response::cookies signature (now ignores errors)
2019-04-09 12:54:10 -07:00
Christoph Herzog
954fdfae30 Implement cookie store support
This commit introduces a cookie store / session support
for both the async and the sync client.

Functionality is based on the cookie crate,
which provides a HTTP cookie abstraction,
and the cookie_store crate which provides a
store that handles cookie storage and url/expiration
based cookie resolution for requests.

Changes:
* adds new private dependencies: time, cookie, cookie_store
* a new cookie module which provides wrapper types around
    the dependency crates
* a Response::cookies() accessor for iterating over response cookies
* a ClientBuilder::cookie_store() method that enables session functionality
* addition of a cookie_store member to the async client
* injecting request cookies and persisting response cookies
* cookie tests

NOTE: this commit DOES NOT expose the CookieStore itself,
limiting available functionality.

This is desirable, but omitted for now due to API considerations that should be fleshed out in the future.
This means users do not have direct access to the cookie session for now.
2019-04-09 12:54:10 -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
5c3494b81d Check redirect locations are valid Uris (#486)
Closes #484
2019-04-01 11:13:01 -07:00
Sean McArthur
7eae51f56e add form-urlencoded unit test 2019-02-13 11:46:12 -08:00
Kevin Wilson
4c21127f15 add async multipart request handling 2019-01-07 10:57:51 -08:00
Sean McArthur
ad854c3ee8 add Proxy::basic_auth support
Closes #322
2019-01-04 14:40:19 -08:00
quininer
37039760f8 Add rustls support (#390) 2018-12-17 11:57:43 -08:00
Sean McArthur
478ef9bf15 add Response::remote_addr() method
The new `remote_addr` method returns an `Option<SocketAddr>`, which is
`Some` if the underlying transport uses socket addresses.

Closes #373
2018-10-26 14:23:33 -07:00
Sean McArthur
acd23d057a fix tests generating an extra blank Txn for each server 2018-10-17 14:17:08 -07:00
Sean McArthur
512b80a3ad ensure async request is canceled if there is a timeout 2018-10-17 13:38:54 -07:00
Sean McArthur
15857a11a4 fix streaming body from wrongly returning 'closed connection' error 2018-09-19 16:38:33 -07:00
Sean McArthur
2698148743 fix improper handling of request body backpressure
Closes #348
2018-09-19 14:20:12 -07:00
Sean McArthur
3fbda4fd49 remove unstable language and feature 2018-08-15 16:08:47 -07:00
kennytm
a52520941f multipart: Force a CRLF at the end of request 2018-07-27 11:40:38 -07:00
Yash Srivastav
c417d6dab8 Upgrade hyper to 0.12
Closes #304
2018-07-05 10:03:31 -07:00
Sean McArthur
7db860759d Revert "Merge pull request #232 from tafia/hyper-proxy"
This reverts commit b09b8620a6, reversing
changes made to abfcd2796e.
2018-02-15 12:13:33 -08:00
messense
0203fad886 Detect encoding in Response::text() (#256)
* Detect encoding and decode text response

Fixes #246

* Try to get encoding from Content-Type header

* Remove uchardet encoding detection for now

* Add non utf-8 test case for Response::text()

* Reduce copies
2018-02-15 11:01:57 -08:00
Sean McArthur
af49be0ce6 update to log 0.4 2018-01-19 17:55:15 -08:00
Johann Tuffe
871b8076e4 add proxy authorization 2017-12-19 15:44:06 +08:00
Johann Tuffe
2f403175dc uses hyper-proxy 0.3.0 2017-12-19 15:23:39 +08:00