From f22b41956f55c481d270c41ca17656027296bfe1 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Mon, 22 Feb 2021 11:26:12 +0100 Subject: [PATCH] Update url crate to 2.1 --- Cargo.lock | 54 +++++++++----------------------------- Cargo.toml | 2 +- connect/Cargo.toml | 2 +- core/Cargo.toml | 2 +- core/src/apresolve.rs | 2 +- core/src/connection/mod.rs | 4 +-- 6 files changed, 19 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 426d4fd9..65493a27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,7 +336,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f" dependencies = [ - "percent-encoding 2.1.0", + "percent-encoding", "time 0.2.25", "version_check", ] @@ -348,13 +348,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3818dfca4b0cb5211a659bbcbb94225b7127407b2b135e650d717bfb78ab10d3" dependencies = [ "cookie", - "idna 0.2.2", + "idna", "log", "publicsuffix", "serde", "serde_json", "time 0.2.25", - "url 2.2.1", + "url", ] [[package]] @@ -578,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -990,17 +990,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.2" @@ -1286,7 +1275,7 @@ dependencies = [ "rpassword", "sha-1", "tokio", - "url 1.7.2", + "url", ] [[package]] @@ -1333,7 +1322,7 @@ dependencies = [ "sha-1", "tokio", "tokio-stream", - "url 1.7.2", + "url", ] [[package]] @@ -1368,7 +1357,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "url 1.7.2", + "url", "vergen", ] @@ -1797,12 +1786,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -1975,10 +1958,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b" dependencies = [ "error-chain", - "idna 0.2.2", + "idna", "lazy_static", "regex", - "url 2.2.1", + "url", ] [[package]] @@ -1987,7 +1970,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" dependencies = [ - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -2801,22 +2784,11 @@ dependencies = [ "once_cell", "qstring", "rustls", - "url 2.2.1", + "url", "webpki", "webpki-roots", ] -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.1" @@ -2824,9 +2796,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ "form_urlencoded", - "idna 0.2.2", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6e5ca032..6b8cbee5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ hyper = "0.14" log = "0.4" rpassword = "5.0" tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "signal", "sync", "process"] } -url = "1.7" +url = "2.1" sha-1 = "0.9" [features] diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 55476466..b03de885 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -24,7 +24,7 @@ serde_json = "1.0" sha-1 = "0.9" tokio = { version = "1.0", features = ["macros", "rt", "sync"] } tokio-stream = { version = "0.1" } -url = "1.7" +url = "2.1" dns-sd = { version = "0.1.3", optional = true } libmdns = { version = "0.6", optional = true } diff --git a/core/Cargo.toml b/core/Cargo.toml index 5c5fa600..373e3088 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -39,7 +39,7 @@ thiserror = "1" tokio = { version = "1.0", features = ["io-util", "net", "rt", "sync"] } tokio-stream = "0.1" tokio-util = { version = "0.6", features = ["codec"] } -url = "1.7" +url = "2.1" [build-dependencies] rand = "0.8" diff --git a/core/src/apresolve.rs b/core/src/apresolve.rs index 7698691c..2086d3b1 100644 --- a/core/src/apresolve.rs +++ b/core/src/apresolve.rs @@ -32,7 +32,7 @@ cfg_if! { let response = if let Some(url) = proxy { Client::builder() - .build(ProxyTunnel::new(url)?) + .build(ProxyTunnel::new(&url.socket_addrs(|| None)?[..])?) .request(req) .await? } else { diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index a07f9a2d..b715d357 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -76,8 +76,8 @@ pub async fn connect(addr: String, proxy: &Option) -> io::Result .next() .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Missing port"))?; - let socket_addr = proxy.to_socket_addrs().and_then(|mut iter| { - iter.next().ok_or_else(|| { + let socket_addr = proxy.socket_addrs(|| None).and_then(|addrs| { + addrs.into_iter().next().ok_or_else(|| { io::Error::new( io::ErrorKind::NotFound, "Can't resolve proxy server address",