From 079d6abf94c30f491b993de1b8983fb7510aeb20 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:16:22 -0800 Subject: [PATCH] Rip out reqwest-middleware --- Cargo.lock | 33 ------------------- Cargo.toml | 1 - crates/criticalup-core/Cargo.toml | 1 - .../src/download_server_client.rs | 9 +++-- crates/criticalup-core/src/errors.rs | 2 -- 5 files changed, 4 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c54aef5..2daf163 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,29 +89,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - [[package]] name = "ascii" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "autocfg" version = "1.2.0" @@ -719,7 +702,6 @@ dependencies = [ "log", "mock-download-server", "reqwest", - "reqwest-middleware", "serde", "serde_json", "sha2", @@ -1929,21 +1911,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "reqwest-middleware" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1ccd3b55e711f91a9885a2fa6fbbb2e39db1776420b062efc058c6410f7e5e3" -dependencies = [ - "anyhow", - "async-trait", - "http 1.1.0", - "reqwest", - "serde", - "thiserror", - "tower-service", -] - [[package]] name = "rfc6979" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index dd3b057..28e1b05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ futures = "0.3" tempfile = "3" tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs", "process"] } reqwest = { version = "0.12.8", default-features = false, features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots"] } -reqwest-middleware = { version = "0.4", features = ["rustls-tls"] } tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false, features = [ "ansi", diff --git a/crates/criticalup-core/Cargo.toml b/crates/criticalup-core/Cargo.toml index bc735d3..099b5f3 100644 --- a/crates/criticalup-core/Cargo.toml +++ b/crates/criticalup-core/Cargo.toml @@ -19,7 +19,6 @@ toml_edit = { version = "0.22.13", features = ["serde"] } sha2 = { version = "0.10.8" } dirs = { version = "5.0.1", default-features = false } tokio.workspace = true -reqwest-middleware.workspace = true tracing.workspace = true [dev-dependencies] diff --git a/crates/criticalup-core/src/download_server_client.rs b/crates/criticalup-core/src/download_server_client.rs index 5bb0fa7..ff55a26 100644 --- a/crates/criticalup-core/src/download_server_client.rs +++ b/crates/criticalup-core/src/download_server_client.rs @@ -9,14 +9,14 @@ use criticaltrust::manifests::ReleaseManifest; use criticaltrust::manifests::{KeysManifest, ReleaseArtifactFormat}; use criticaltrust::signatures::Keychain; use reqwest::header::{HeaderValue, AUTHORIZATION}; -use reqwest::StatusCode; +use reqwest::Client; +use reqwest::{RequestBuilder, StatusCode}; use reqwest::{Response, Url}; -use reqwest_middleware::{ClientBuilder, ClientWithMiddleware, RequestBuilder}; use serde::Deserialize; pub struct DownloadServerClient { base_url: String, - client: ClientWithMiddleware, + client: Client, state: State, trust_root: PublicKey, } @@ -27,7 +27,6 @@ impl DownloadServerClient { .user_agent(config.whitelabel.http_user_agent) .build() .expect("failed to configure http client"); - let client = ClientBuilder::new(client).build(); DownloadServerClient { base_url: config.whitelabel.download_server_url.clone(), @@ -137,7 +136,7 @@ impl DownloadServerClient { let response_result = self.client.execute(req).await; let response = response_result.map_err(|e| Error::DownloadServerError { - kind: DownloadServerError::NetworkWithMiddleware(e), + kind: DownloadServerError::Network(e), url, })?; diff --git a/crates/criticalup-core/src/errors.rs b/crates/criticalup-core/src/errors.rs index 5de9db3..35aa65b 100644 --- a/crates/criticalup-core/src/errors.rs +++ b/crates/criticalup-core/src/errors.rs @@ -123,8 +123,6 @@ pub enum DownloadServerError { UnexpectedResponseData(#[source] serde_json::Error), #[error("Failed to send the network request.")] Network(#[source] reqwest::Error), - #[error("Failed to send the network request.")] - NetworkWithMiddleware(#[source] reqwest_middleware::Error), } #[derive(Debug, thiserror::Error)]