From 64c450576149fb69d368a28ec81fd91494d37107 Mon Sep 17 00:00:00 2001 From: PotentialStyx <62217716+PotentialStyx@users.noreply.github.com> Date: Sat, 13 Jan 2024 18:02:25 -0800 Subject: [PATCH] build(deps): Update hyper to 1.1 This builds and should work, further testing might be needed to make sure there are no regressions. --- Cargo.lock | 111 +++++++++++++++++++++++++++++++++++++------- Cargo.toml | 8 ++-- src/parse_paseto.rs | 18 +++++-- 3 files changed, 112 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c131db7..3a073fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,9 +154,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "itoa", "matchit", "memchr", @@ -186,8 +186,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -903,16 +903,16 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.23" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" +checksum = "991910e35c615d8cab86b5ab04be67e6ad24d2bf5f4f11fdbbed26da999bbeab" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 1.0.0", "indexmap 2.1.0", "slab", "tokio", @@ -1021,8 +1021,10 @@ dependencies = [ "futures", "futures-channel", "futures-util", - "hyper", + "http-body-util", + "hyper 1.1.0", "hyper-tls", + "hyper-util", "log", "migration", "pasetors", @@ -1050,6 +1052,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1057,7 +1070,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1089,9 +1125,8 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1103,17 +1138,59 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite", + "tokio", + "want", +] + [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper", + "http-body-util", + "hyper 1.1.0", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -3332,7 +3409,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.11", "httparse", "log", "rand 0.8.5", diff --git a/Cargo.toml b/Cargo.toml index d8744b6..0df4344 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ repldb = ["database"] database = ["dep:sea-orm", "dep:sea-query", "dep:migration", "dep:entity"] replspace = [] fun-stuff = ["dep:chrono", "dep:chrono-tz"] -verify_connections = ["dep:hyper", "dep:hyper-tls"] +verify_connections = ["dep:hyper", "dep:hyper-tls", "dep:hyper-util", "dep:http-body-util"] [dependencies] goval = { path = "protobuf", package = "protobuf" } @@ -54,6 +54,8 @@ migration = { path = "migration", optional = true} entity = { path = "entity", optional = true} sea-query = { version = "0.28.5", optional = true } pasetors = { version = "0.6.7", default-features = false, features = ["v2"] } -hyper = { version = "0.14.26", features = ["http1", "http2", "client"], optional = true } -hyper-tls = { version = "0.5.0", optional = true } +hyper = { version = "1.1.0", features = ["http1", "http2", "client"], optional = true } +hyper-util = { version = "0.1.2", features = ["client", "client-legacy", "http1", "http2"], optional = true } +hyper-tls = { version = "0.6.0", optional = true } +http-body-util = { version = "0.1.0", optional = true } anyhow = "1.0.71" diff --git a/src/parse_paseto.rs b/src/parse_paseto.rs index c366338..3ce4514 100644 --- a/src/parse_paseto.rs +++ b/src/parse_paseto.rs @@ -41,15 +41,23 @@ fn parse_noverify(input: &str) -> Result<(Vec, bool)> { #[cfg(feature = "verify_connections")] async fn init_keys() -> Result> { + use http_body_util::{BodyExt, Collected}; + use hyper_tls::HttpsConnector; + use hyper_util::client::legacy::{connect::HttpConnector, Client}; + use hyper_util::rt::TokioExecutor; + let key_get = std::env::var("HOMEVAL_PASETO_KEY_URL")?; - let https = hyper_tls::HttpsConnector::new(); - let client = hyper::Client::builder().build::<_, hyper::Body>(https); + let https = HttpsConnector::new(); + let client: Client, Collected<_>> = + Client::builder(TokioExecutor::new()) + .build::, Collected>(https); + + let mut _body = client.get(hyper::Uri::try_from(key_get)?).await?; - let _body = client.get(hyper::Uri::try_from(key_get)?).await?; - let body = hyper::body::to_bytes(_body).await?.to_vec(); + let body = _body.body_mut().collect().await?.to_bytes(); - Ok(serde_json::from_slice(body.as_slice())?) + Ok(serde_json::from_slice(&body)?) } #[cfg(feature = "verify_connections")]