Commit Graph

71 Commits

Author SHA1 Message Date
lpraneis
ae2d521664 Add ability to specify multiple IP addresses for resolver overrides (#1622)
This change allows the `ClientBuilder::resolve_to_addrs` method to accept a
slice of `SocketAddr`s for overriding resolution for a single domain.
Allowing multiple IPs more accurately reflects behavior of `getaddrinfo`
and allows users to rely on hyper's happy eyeballs algorithm to connect
to a host that can accept traffic on IPv4 and IPv6.
2022-09-19 13:53:36 -07:00
Biagio Festa
8b37ae4b15 Support to rustls 0.20 (#1388) 2021-11-29 12:25:57 -08:00
Jonas Platte
2881354c90 Fix more clippy warnings 2021-08-26 13:42: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
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
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
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
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
Ngo Iok Ui (Wu Yu Wei)
00fb43b650 Add tcp_keepalive option for ClientBuilder (#1070) 2020-10-29 08:23:01 -07:00
daxpedda
a5f3de0740 Remove unnecessary Result returns. 2020-03-03 10:54:49 -08:00
daxpedda
c1c2b9dd7b Implement ability to disable trust-dns in ClientBuilder. 2020-03-03 10:54:49 -08:00
Sean McArthur
2e983694f6 Re-enable trust-dns optional feature (#787) 2020-02-27 12:57:13 -08:00
Sean McArthur
2e06108f70 Require the native-tls feature to supply a preconfigured tls (#814) 2020-02-21 12:41:13 -08:00
Nick Lanham
9ab8ab945c add ability to create a client with own tls connector (#809) 2020-02-21 11:39:31 -08:00
Sean McArthur
76ca042faf Only set nodelay for HTTPS if not already set (#783) 2020-01-13 14:26:55 -08:00
Sean McArthur
e31d5221fe Refactor connect errors to not use io::Error (#782) 2020-01-13 13:29:14 -08:00
Sean McArthur
14908ad3f0 Improve debug logging (#781) 2020-01-13 12:24:38 -08:00
Sean McArthur
50c33a932e Add connection_verbose setting to log IO events (#774) 2020-01-09 13:42:01 -08:00
r-arias
20d50daa8b re-add the "socks" feature (using tokio-socks) (#769)
The "socks" feature has been removed for a while now, the optional
dependency on the "socks" crate commented out.

The code for actually providing the socks feature was, however, still
mostly present, if a bit out of date.

This commit re-adds the socks feature using the tokio-socks (instead of
socks) crate.

Closes #620
2020-01-09 12:25:26 -08:00
Sean McArthur
09e7fe62e3 Don't set User-Agent header by default (#751) 2019-12-23 12:48:11 -08:00
Sean McArthur
24abf2fcbd Separate default-tls and native-tls features (#749)
To allow for the default-tls to change to a different backend by
default, this adds a new `native-tls` optional feature. Any TLS feature
that was only available using native-tls now requires the `native-tls`
feature to be enabled.
2019-12-20 13:22:56 -08:00
Sean McArthur
18fd9a63b0 Re-enable rustls (#747) 2019-12-19 11:43:03 -08:00
Sean McArthur
a57afd50ea Reduce futures optional features (#737) 2019-12-12 12:34:44 -08:00
Gleb Pomykalov
0f32c4a01a Update to hyper 0.13 2019-12-10 16:24:05 -08:00
Sean McArthur
40d4d05e4e Remove username and password when parsing proxies (#686) 2019-10-17 17:27:25 -07:00
Sean McArthur
5b55aee1a9 Send user-agent in proxy tunnel requests 2019-10-03 10:34:51 -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
5fb04356fc Re-enable rustls feature (#625) 2019-09-09 12:45:45 -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
e45d77584b repair a dodgy find and replace 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
1452ca2bd1 remove unnecessary extern crate lines 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
Vignesh Karuthedath (വിഘ്നേഷ് ശ൪മ കെ)
36f2b78122 Give more useful errors when connection through proxy fails
Before the fix anything other than 200 & 407 would throw an unhelpful
`unsuccessful tunnel` error.
After this change,
- Explicit handling of 403, where the proxy forbids a connection.
- All other responses will be part of the error message.
2019-08-16 10:54:09 -07:00
Sean McArthur
964d87ce57 Update trait object syntax to use 'dyn' 2019-06-03 13:15:09 -07:00
Diggory Blake
c45ff29bfb Add support for SOCKS5 proxies, and parsing proxy authorizations from URLs 2019-04-08 11:42:18 -07:00
quininer
f02ca0ded0 disable Nagle's for default-tls handshake 2019-03-20 14:09:31 -07:00
quininer
47640170bb Add tcp_nodelay for Builder 2019-03-20 14:09:31 -07:00
quininer
f5e7e883c7 disable nagle algorithm for TLS handshake 2019-03-20 14:09:31 -07:00
quininer
a27db28deb fix proxy missing alpn (#466)
* fix #459

* disable alpn for proxy connection
2019-03-06 11:02:55 -08:00
Sean McArthur
9e2b56ba56 Add connect_timeout to async and sync clients 2019-02-20 15:15:55 -08:00
Sean McArthur
66db8d6283 refactor connect_async module into connect module 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
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