From 59679e066d7982b8afae5538ee51944c2504b898 Mon Sep 17 00:00:00 2001 From: Gary Krause Date: Tue, 31 Dec 2024 13:42:07 -0500 Subject: [PATCH] fix: cargo fmt --- src/http.rs | 10 ++++++---- src/sinks/databend/config.rs | 2 +- src/sinks/prometheus/exporter.rs | 2 +- src/sources/util/http_client.rs | 5 ++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/http.rs b/src/http.rs index c02de85eae460..6d49f858ca2f0 100644 --- a/src/http.rs +++ b/src/http.rs @@ -57,13 +57,15 @@ pub enum HttpError { #[snafu(display("Failed to build HTTP request: {}", source))] BuildRequest { source: http::Error }, #[snafu(display("Expected 401 with Digest Auth"))] - DigestAuthExpectation + DigestAuthExpectation, } impl HttpError { pub const fn is_retriable(&self) -> bool { match self { - HttpError::BuildRequest { .. } | HttpError::MakeProxyConnector { .. } | HttpError::DigestAuthExpectation => false, + HttpError::BuildRequest { .. } + | HttpError::MakeProxyConnector { .. } + | HttpError::DigestAuthExpectation => false, HttpError::CallRequest { .. } | HttpError::BuildTlsConnector { .. } | HttpError::MakeHttpsConnector { .. } => true, @@ -298,7 +300,7 @@ pub enum Auth { token: SensitiveString, }, /// Digest authentication. - /// + /// /// requires a round trip to the server to get the challenge and then send the response Digest { /// The digest authentication username. @@ -352,7 +354,7 @@ impl Auth { Auth::Digest { user, password } => { let auth = Authorization::basic(user.as_str(), password.inner()); map.typed_insert(auth); - }, + } } } } diff --git a/src/sinks/databend/config.rs b/src/sinks/databend/config.rs index 970c0154db5ae..3dfde1ff91d7c 100644 --- a/src/sinks/databend/config.rs +++ b/src/sinks/databend/config.rs @@ -132,7 +132,7 @@ impl SinkConfig for DatabendConfig { } Some(Auth::Digest { .. }) => { return Err("Digest authentication is not supported currently".into()); - }, + } None => {} } if let Some(database) = &self.database { diff --git a/src/sinks/prometheus/exporter.rs b/src/sinks/prometheus/exporter.rs index 678439c5a71a8..57f103baf8a08 100644 --- a/src/sinks/prometheus/exporter.rs +++ b/src/sinks/prometheus/exporter.rs @@ -322,7 +322,7 @@ fn authorized(req: &Request, auth: &Option) -> bool { ), Auth::Bearer { token } => { HeaderValue::from_str(format!("Bearer {}", token.inner()).as_str()) - }, + } Auth::Digest { .. } => { error!("Digest authentication is not supported."); return false; diff --git a/src/sources/util/http_client.rs b/src/sources/util/http_client.rs index a7cae6cfc96c3..a223d93e3324e 100644 --- a/src/sources/util/http_client.rs +++ b/src/sources/util/http_client.rs @@ -13,11 +13,11 @@ use futures_util::{stream, FutureExt, StreamExt, TryFutureExt}; use http::{response::Parts, Uri}; use hyper::{Body, Request}; use md5::Digest; -use vector_lib::sensitive_string::SensitiveString; use std::time::Duration; use std::{collections::HashMap, future::ready}; use tokio_stream::wrappers::IntervalStream; use vector_lib::json_size::JsonSize; +use vector_lib::sensitive_string::SensitiveString; use crate::{ http::{Auth, HttpClient}, @@ -178,7 +178,6 @@ pub(crate) async fn call< // building an empty request should be infallible let mut request = builder.body(Body::empty()).expect("error creating request"); - let mut is_digest = false; let mut username = "".to_string(); let mut user_password = SensitiveString::default(); @@ -193,7 +192,7 @@ pub(crate) async fn call< _ => false }; } - + tokio::time::timeout(inputs.timeout, client.send(request)) .then({ let headers_value = headers.clone();