Commit Graph

108 Commits

Author SHA1 Message Date
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
quininer
47640170bb Add tcp_nodelay for Builder 2019-03-20 14:09:31 -07:00
CJP10
a54bfc1a39 added max_idle_per_host as an option to the builder (#473) 2019-03-19 13:23:32 -07:00
Antoine Carton
aa8348ba1e Add http1_title_case_headers option to ClientBuilder (#463) 2019-02-27 13:21:50 -08:00
Sean McArthur
9e2b56ba56 Add connect_timeout to async and sync clients 2019-02-20 15:15:55 -08:00
Michael Habib
4dc679d535 Add ClientBuilder::local_address option to bind to a local IP address (#451)
Closes #414
2019-02-11 10:40:16 -08:00
Evan Schwartz
6e8e781f8f Add ClientBuilder::h2_prior_knowlege() (#443)
resolves https://github.com/seanmonstar/reqwest/issues/413
2019-01-18 14:15:57 -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
691bcfe894 improve general documentation 2019-01-07 14:20:39 -08:00
Sean McArthur
0f4055f9ec remove Error::is_runtime_startup accessor 2019-01-03 11:07:09 -08:00
Sean McArthur
59f57072ac Remove timeout waiting for runtime thread to start 2019-01-03 09:36:54 -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
44837c1b69 Replace getaddrinfo resolver with trust-dns-resolver 2018-12-18 12:54:22 -08:00
quininer
37039760f8 Add rustls support (#390) 2018-12-17 11:57:43 -08:00
David Wilemski
6ef2060510 Added dns_threads setter to sync ClientBuilder (#381) 2018-11-05 11:27:32 -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
Sean McArthur
512b80a3ad ensure async request is canceled if there is a timeout 2018-10-17 13:38:54 -07:00
Sean McArthur
a82232f0ee always wait a max of 5 seconds for sync Client's background thread to start 2018-10-17 12:33:59 -07:00
Yannick Heinrich
647f59756e Add missing pub(crate) statements. 2018-10-05 11:19:52 -07:00
Paul Woolcock
4857a5917d From<http::Response> for Response (#360)
This adds an implementation to convert a `Response` type from the `http`
crate to the `async_impl::Response` type. This is the first step to
allow us to convert `http::Response` objects to `request::Response`
objects

This also adds an extension trait for the `http::response::Builder`
type. The `http::Response` object does not provide a way to access the
"final" url that the response is derived from, so we can't easily
provide that in the `From<http::Response>` implementation. For users who
are manually constructing `http::Response` objects for use in tests,
etc, they can import this extension trait, which adds a `.url()` builder
method that will allow them to pass a `Url`, which we then convert to
our newtype'd Url and add to the `http::Response`'s `extensions`. Then,
when converting from `http::Response` to `async_impl::Response` we can
pull that value out of the `extensions` and use it to construct the
`async_impl::Response`

Closes #333
2018-10-04 17:38:26 -07:00
Yannick Heinrich
22fa725f48 Document gzip client's behaviour (#358)
As suggested in #306, the behaviour of the `auto gzip decompression` should
be clearly explained inside the documentation.

Closes #306
2018-10-03 10:14:41 -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
610cdd266c Fix panicking when passed a file:// URL
Closes #347
2018-09-18 12:43:54 -07:00
Sean McArthur
ef529df3f2 remove inline annotations on client builder methods 2018-08-23 10:04:25 -07:00
Sean McArthur
afbeb1a384 change ClientBuilders to by-value builders 2018-08-23 10:04:25 -07:00
Sean McArthur
d060891b62 fix async request builder tests 2018-08-15 15:36:05 -07:00
Scott Schroeder
d8e47babf6 change invalid cert api to match native-tls (#327) 2018-08-13 15:08:02 -07:00
Yannick Heinrich
11f8588989 upgrade to native-tls 0.2 + invalid certs (#325)
- Bumps `native-tls` dependency to 0.2 and adapt code accordingly
- Import code used from `tokio-tls` into `connect_async` and adapt dependencies accordinlgy
- Add an option for using `danger_accept_invalid_certs` inside the `Config` struct
2018-08-08 13:14:36 -07:00
Yash Srivastav
c417d6dab8 Upgrade hyper to 0.12
Closes #304
2018-07-05 10:03:31 -07:00
knight42
f4437ea7b1 feat: set default headers 2017-10-22 13:01:35 +08:00
Sean McArthur
779f8080ef change Builders to only error at the end
Closes #189
2017-08-31 18:10:45 -07:00
Sean McArthur
cf133f7919 change default Client timeout to 30 seconds
Closes #181
2017-08-30 14:18:21 -07:00
Anthony Nowell
646c8b8efc Support PKCS12 identity on the ClientBuilder 2017-08-25 15:38:45 -07:00
Sean McArthur
dc44e742a0 fix deprecated UnboundedSender::send() to unbounded_send() 2017-08-24 15:23:14 -07:00
Ashley Mannix
e2fa97254e support async gzip decoding 2017-08-18 19:43:06 +10:00
James Brown
5071438c08 join on client thread when all clients have been dropped, take two 2017-08-17 09:35:30 -07:00
Sean McArthur
8296c5e28e fix broken doc test 2017-07-13 14:19:22 -07:00
Sean McArthur
7f9750d072 fix doc test on clientbuilder 2017-07-13 13:24:01 -07:00
Sean McArthur
12ee6fbcde small improvements to docs 2017-07-13 12:17:38 -07:00
Sean McArthur
6cdaff4b66 add a Proxy type
Proxies can currently be configured to intercept HTTP, HTTPS, and all
requests. HTTPS tunneling is supported.

Closes #30
2017-06-22 09:49:00 -07:00
Sean McArthur
665b4fe718 upgrade hyper to v0.11 2017-06-21 09:47:21 -07:00
Sean McArthur
e45f234b4a fix socket_is_dead on windows 2017-06-07 17:02:15 -07:00
Sean McArthur
00382f8d06 use a stale check in the pool
Check that a socket is not EOF to reduce the likelihood of using
a bad pooled connection.
2017-06-06 13:31:28 -07:00
Michal Budzynski
026dca2512 Added missing "Errors" sections to client.rs and lib.rs 2017-06-04 04:48:13 +02:00
Sean McArthur
e176dcebca convert RequestBuilder to a &mut Self builder
Closes #108
2017-06-01 16:23:16 -07:00
Tom Prince
a36ed4a87a Add a conversion from native_tls::Error. 2017-05-31 19:27:45 -06:00
Sean McArthur
8d784faa98 move all configuration from Client to ClientBuilder 2017-05-31 18:14:47 -07:00
Corentin Henry
0f0bf882d9 add an error section to RequestBuilder.json 2017-05-31 17:50:20 -07:00
Corentin Henry
20f2896ab4 tweak add_json_fail test 2017-05-31 17:41:48 -07:00