Commit Graph

51 Commits

Author SHA1 Message Date
Vidhan Bhatt
e9ba0a9dc7 docs: fix broken doc comment example. (#1584) 2022-07-19 07:10:30 -07:00
Kaede Hoshikawa
74e70627be Migrate to once_cell. (#1565) 2022-07-18 16:16:59 -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
wspsxing
ee57777d42 fix basic-auth for access http over https's proxy (#1491) 2022-03-14 11:08:04 -07:00
Victor Saase
eb8e9d52c5 do not accept empty or whitespace proxy address (#1423)
Closes #1422
2022-01-06 10:49:40 -08:00
Adam Batkin
203cd5bfdc Follow cURL's rules for parsing and matching NO_PROXY (#1332)
There are a few ways in which reqwest's handling of NO_PROXY differs from cURL (and other implementations). The biggest issue is that whitespace between entries should be ignored/trimmed, but is not (i.e. "NO_PROXY='a, b'" would never match "b"). In addition, according to cURL's rules, a NO_PROXY entry without a leading dot should match the domain itself as well as any subdomains (reqwest only handles exact matches if there is no leading dot) and entries with a leading dot should only match subdomains (but request allows exact matches). Finally, cURL allows a special entry "*" to match all entries (effectively disabling use of the proxy).
2021-10-07 11:39:31 -07:00
Jonas Platte
4be5ec7ffd Replace use of assert_eq with assert
Reported by clippy.
2021-08-26 13:42:46 -07:00
Pawan Singh Bisht
544282a0b4 proxy: refactor a collapsible_match (#1214) 2021-03-17 09:51:51 -07: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
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
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
Federico Terzi
7595dcb3f7 Default HTTPS proxy protocol to HTTP if not explicitly specified otherwise (#1082)
Fix #1080
2020-11-11 06:26:44 -08:00
fuyu
9e23103371 Fix detection of system proxy from Windows registry (#1005) 2020-08-19 11:38:21 -07:00
Takayuki Maeda
1e6957a4ac Fix clippy warnings (#981)
* refactor: fix clippy warnings

* refactor: fix redundant_closure

* refactor: fix collapsible if

* refactor: remove unnecessary_unwrap
2020-07-27 09:02:47 -07:00
Taylor Thomas
6914091582 feat(proxy): Adds NO_PROXY environment variable support (#877)
* feat(proxy): Adds NO_PROXY environment variable support

Adds support for loading from the `NO_PROXY` or `no_proxy` environment
variables. This should make reqwest support the system proxy settings.
Please note that I brought in one additional dependency in order to
handle CIDR blocks in the no proxy settings.

Closes #705
2020-06-08 15:32:56 -07:00
Kent Fredric
6a41459862 Guard reqwest::proxy libtests against concurrent ENV modification
As ENV is process global, modifying it within a thread (as is normal
for all test targets in a rust libtest) results in a concurrency
data-race.

This patch fences the two known cases of needing to modify this by
locking all ENV modifications, and collection of data dependent on
said modifications, into a narrow path isolated by a Mutex lock, with
no test assert!()'s while the Mutex is held
( to avoid a Mutex Posioning ).

However, the code doesn't treat lock failure as a special circumstance,
and if the lock fails, then the pre-existing risk of conccurent ENV
modification returns, and these 2 tests can still randomly fail, but
_in that situation_.

And as mutexes can _only_ be poisoned by the 2 threads holding this
mutex, this regression can now only trip into concurrency issues when
either of these 2 tests are already failing from _non test_ assertions,
so this patch still improves the status quo substantially.

Closes: https://github.com/seanmonstar/reqwest/issues/829
2020-03-09 11:30:04 -07:00
Sean McArthur
14908ad3f0 Improve debug logging (#781) 2020-01-13 12:24:38 -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
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
31e64e9f28 prevent using HTTP_PROXY if detected inside CGI (#684) 2019-10-17 16:21:39 -07:00
Sean McArthur
7739e03123 Enable "system" proxies by default (#683)
If no proxies are configured for a client, the environment (system) will
be inspected automatically to set up proxies.

Configuring a `Proxy` on a client or calling `no_proxy` will disable the
use of the automatic system proxy.

Closes #403
2019-10-17 13:32:00 -07:00
Sean McArthur
6b5726aaa8 Improve fmt::Debug of Client and ClientBuilder 2019-10-09 13:46:39 -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
Lucas
80c4294b74 documented socks proxy (#609) 2019-09-05 09:37:21 -07:00
Nikhil Benesch
f60456c8e3 Upgrade to url v2.0 (#583) 2019-09-04 18:27:20 -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
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
WindSoilder
577d06c363 Add support for system/environment proxies (#547) 2019-07-01 16:27:58 -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
Sean McArthur
5c3494b81d Check redirect locations are valid Uris (#486)
Closes #484
2019-04-01 11:13:01 -07:00
Sean McArthur
ad854c3ee8 add Proxy::basic_auth support
Closes #322
2019-01-04 14:40:19 -08:00
Yannick Heinrich
c4bf420021 Integrate helper functions inside corresponding structs 2018-10-05 11:19:52 -07:00
Yannick Heinrich
647f59756e Add missing pub(crate) statements. 2018-10-05 11:19:52 -07:00
Sean McArthur
610cdd266c Fix panicking when passed a file:// URL
Closes #347
2018-09-18 12:43:54 -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
Johann Tuffe
fa0debd128 add back Proxy::Clone 2017-12-29 10:24:11 +08:00
Johann Tuffe
4101c78a1f use hyper-proxy 0.4.0 which allows multiple proxies 2017-12-21 15:40:36 +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
Johann Tuffe
07f89984c4 store intercept to set_proxy on requests 2017-12-18 17:53:17 +08:00
Johann Tuffe
8b1bb0b53e remove proxy handling in favor of hyper-proxy crate 2017-12-15 11:51:02 +08:00
Sean McArthur
9631b31bfc adjust proxy doc example 2017-10-26 15:31:06 -07:00
Sean McArthur
779f8080ef change Builders to only error at the end
Closes #189
2017-08-31 18:10:45 -07:00
Sean McArthur
229a2384a6 add Proxy::custom to allow custom proxy functions 2017-08-02 15:03:37 -07:00