Skip to content

Commit

Permalink
build(deps): Update hyper to 1.1
Browse files Browse the repository at this point in the history
This builds and should work, further testing might be needed to make sure there are no regressions.
  • Loading branch information
PotentialStyx committed Jan 14, 2024
1 parent 86d9cdc commit 64c4505
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 25 deletions.
111 changes: 94 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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"
18 changes: 13 additions & 5 deletions src/parse_paseto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ fn parse_noverify(input: &str) -> Result<(Vec<u8>, bool)> {

#[cfg(feature = "verify_connections")]
async fn init_keys() -> Result<std::collections::HashMap<String, String>> {
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<HttpsConnector<HttpConnector>, Collected<_>> =
Client::builder(TokioExecutor::new())
.build::<HttpsConnector<HttpConnector>, Collected<prost::bytes::Bytes>>(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")]
Expand Down

0 comments on commit 64c4505

Please sign in to comment.