reqwest_client: Only register proxies with valid proxy URIs (#27773)
Closes #27641 This PR fixes invalid proxy URIs being registered despite the URI not being a valid proxy URI. Whilst investigating #27641 , I noticed that currently any proxy URI passed to `RequestClient::proxy_and_user_agent` will be assigned to the created client, even if the URI is not a valid proxy URI. Given a test as an example: We create an URI here and pass it as a proxy to `ReqwestClient::proxy_and_user_agent`: https://github.com/zed-industries/zed/blob/main/crates/reqwest_client/src/reqwest_client.rs#L272-L273 In `ReqwestClient::proxy_and_user_agent`we take the proxy parameter here9b40770e9f/crates/reqwest_client/src/reqwest_client.rs (L46)
and set it unconditionally here:9b40770e9f/crates/reqwest_client/src/reqwest_client.rs (L62)
, not considering at all whether the proxy was successfully created above. Concluding, we currently do not actually check whether a proxy was successfully created, but rather whether an URI is equal to itself, which trivially holds. The existing test for a malformed proxy URI9b40770e9f/crates/reqwest_client/src/reqwest_client.rs (L293-L297)
does not check whether invalid proxies cause an error, but rather checks whether `http::Uri::from_static` panics on an invalid URI, [which it does as documented](https://docs.rs/http/latest/http/uri/struct.Uri.html#panics). Thus, the tests currently do not really check anything proxy-related and invalid proxies are assigned as valid proxies. --- This PR fixes the behaviour by considering whether the proxy was actually properly parsed and only assigning it if that is the case. Furthermore, it improves logging in case of errors so issues like the linked one are easier to debug (for the linked issue, the log will now include that the proxy schema is not supported in the logs). Lastly, it also updates the test for a malformed proxy URI. The test now actually checks that malformed proxy URIs are not registered for the client rather than testing the `http` crate. The update also initially caused the [test for a `socks4a` proxy](9b40770e9f/crates/reqwest_client/src/reqwest_client.rs (L280C1-L282C50)
) to fail. This happened because the reqwest-library introduced supports for `socks4a` proxies in [version 0.12.13](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md#v01213). Thus, this PR includes a bump of the reqwest library to add proper support for socks4a proxies. Release Notes: - Added support for socks4a proxies. --------- Co-authored-by: Peter Tripp <peter@zed.dev>
This commit is contained in:
parent
8a69d252f5
commit
3a1bd38503
12 changed files with 193 additions and 76 deletions
|
@ -263,9 +263,11 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
security-framework = { version = "3", features = ["OSX_10_14"] }
|
||||
security-framework-sys = { version = "2", features = ["OSX_10_14"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
|
||||
[target.x86_64-apple-darwin.build-dependencies]
|
||||
clang-sys = { version = "1", default-features = false, features = ["clang_11_0", "runtime"] }
|
||||
|
@ -288,9 +290,11 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
security-framework = { version = "3", features = ["OSX_10_14"] }
|
||||
security-framework-sys = { version = "2", features = ["OSX_10_14"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
|
||||
[target.aarch64-apple-darwin.dependencies]
|
||||
core-foundation = { version = "0.9" }
|
||||
|
@ -311,9 +315,11 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
security-framework = { version = "3", features = ["OSX_10_14"] }
|
||||
security-framework-sys = { version = "2", features = ["OSX_10_14"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
|
||||
[target.aarch64-apple-darwin.build-dependencies]
|
||||
clang-sys = { version = "1", default-features = false, features = ["clang_11_0", "runtime"] }
|
||||
|
@ -336,9 +342,11 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
security-framework = { version = "3", features = ["OSX_10_14"] }
|
||||
security-framework-sys = { version = "2", features = ["OSX_10_14"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
|
||||
[target.x86_64-unknown-linux-gnu.dependencies]
|
||||
aes = { version = "0.8", default-features = false, features = ["zeroize"] }
|
||||
|
@ -373,11 +381,13 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
smallvec = { version = "1", default-features = false, features = ["write"] }
|
||||
syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
toml_datetime = { version = "0.6", default-features = false, features = ["serde"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
zeroize = { version = "1", features = ["zeroize_derive"] }
|
||||
zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] }
|
||||
|
||||
|
@ -412,11 +422,13 @@ rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["ev
|
|||
rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] }
|
||||
scopeguard = { version = "1" }
|
||||
smallvec = { version = "1", default-features = false, features = ["write"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
toml_datetime = { version = "0.6", default-features = false, features = ["serde"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
zeroize = { version = "1", features = ["zeroize_derive"] }
|
||||
zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] }
|
||||
|
||||
|
@ -453,11 +465,13 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
smallvec = { version = "1", default-features = false, features = ["write"] }
|
||||
syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
toml_datetime = { version = "0.6", default-features = false, features = ["serde"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
zeroize = { version = "1", features = ["zeroize_derive"] }
|
||||
zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] }
|
||||
|
||||
|
@ -492,11 +506,13 @@ rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["ev
|
|||
rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] }
|
||||
scopeguard = { version = "1" }
|
||||
smallvec = { version = "1", default-features = false, features = ["write"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
toml_datetime = { version = "0.6", default-features = false, features = ["serde"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
zeroize = { version = "1", features = ["zeroize_derive"] }
|
||||
zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] }
|
||||
|
||||
|
@ -512,9 +528,11 @@ naga = { version = "23", features = ["spv-out", "wgsl-in"] }
|
|||
ring = { version = "0.17", features = ["std"] }
|
||||
rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event"] }
|
||||
scopeguard = { version = "1" }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
winapi = { version = "0.3", default-features = false, features = ["cfg", "consoleapi", "errhandlingapi", "evntrace", "fileapi", "handleapi", "in6addr", "inaddr", "knownfolders", "minwinbase", "ntsecapi", "objbase", "processenv", "processthreadsapi", "shlobj", "std", "sysinfoapi", "winbase", "windef", "winerror", "winioctl"] }
|
||||
windows-core = { version = "0.61" }
|
||||
windows-numerics = { version = "0.2" }
|
||||
|
@ -535,9 +553,11 @@ proc-macro2 = { version = "1", default-features = false, features = ["span-locat
|
|||
ring = { version = "0.17", features = ["std"] }
|
||||
rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["event"] }
|
||||
scopeguard = { version = "1" }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
winapi = { version = "0.3", default-features = false, features = ["cfg", "consoleapi", "errhandlingapi", "evntrace", "fileapi", "handleapi", "in6addr", "inaddr", "knownfolders", "minwinbase", "ntsecapi", "objbase", "processenv", "processthreadsapi", "shlobj", "std", "sysinfoapi", "winbase", "windef", "winerror", "winioctl"] }
|
||||
windows-core = { version = "0.61" }
|
||||
windows-numerics = { version = "0.2" }
|
||||
|
@ -578,11 +598,13 @@ rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs",
|
|||
scopeguard = { version = "1" }
|
||||
smallvec = { version = "1", default-features = false, features = ["write"] }
|
||||
syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
toml_datetime = { version = "0.6", default-features = false, features = ["serde"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
zeroize = { version = "1", features = ["zeroize_derive"] }
|
||||
zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] }
|
||||
|
||||
|
@ -617,11 +639,13 @@ rustix-d585fab2519d2d1 = { package = "rustix", version = "0.38", features = ["ev
|
|||
rustix-dff4ba8e3ae991db = { package = "rustix", version = "1", features = ["fs", "net", "process", "termios", "time"] }
|
||||
scopeguard = { version = "1" }
|
||||
smallvec = { version = "1", default-features = false, features = ["write"] }
|
||||
sync_wrapper = { version = "1", default-features = false, features = ["futures"] }
|
||||
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
|
||||
tokio-socks = { version = "0.5", features = ["futures-io"] }
|
||||
tokio-stream = { version = "0.1", features = ["fs"] }
|
||||
toml_datetime = { version = "0.6", default-features = false, features = ["serde"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["display", "parse", "serde"] }
|
||||
tower = { version = "0.5", default-features = false, features = ["timeout", "util"] }
|
||||
zeroize = { version = "1", features = ["zeroize_derive"] }
|
||||
zvariant = { version = "5", default-features = false, features = ["enumflags2", "gvariant", "url"] }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue