From 8a3fd4e9acd575e903647223252f08364c576214 Mon Sep 17 00:00:00 2001 From: Brent Gardner Date: Wed, 4 Dec 2024 04:24:33 -0700 Subject: [PATCH] Only enable if requested --- object_store/src/aws/client.rs | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/object_store/src/aws/client.rs b/object_store/src/aws/client.rs index a78d8c7c5e5..c00eca9f199 100644 --- a/object_store/src/aws/client.rs +++ b/object_store/src/aws/client.rs @@ -186,7 +186,7 @@ impl From for Error { } } -#[derive(Debug, Clone)] +#[derive(Debug)] pub(crate) struct S3Config { pub region: String, pub endpoint: Option, @@ -462,27 +462,6 @@ impl S3Client { } } - #[allow(dead_code)] - pub(crate) fn request_with_config<'a>( - &'a self, - method: Method, - path: &'a Path, - config: &'a S3Config, - ) -> Request<'a> { - let url = self.config.path_url(path); - Request { - path, - builder: self.client.request(method, url), - payload: None, - payload_sha256: None, - config, - use_session_creds: true, - idempotent: false, - retry_on_conflict: false, - retry_error_body: false, - } - } - /// Make an S3 Delete Objects request /// /// Produces a vector of results, one for each path in the input vector. If @@ -640,7 +619,7 @@ impl S3Client { checksum: bool, ) -> Result { let mut req = self.request(Method::POST, location); - if checksum { + if self.config.checksum == Some(Checksum::SHA256) && checksum { req = req.header("x-amz-checksum-algorithm", "SHA256"); } let response = req @@ -670,13 +649,9 @@ impl S3Client { ) -> Result { let is_copy = matches!(data, PutPartPayload::Copy(_)); let part = (part_idx + 1).to_string(); - let config = S3Config { - checksum: Some(Checksum::SHA256), - ..self.config.clone() - }; let mut request = self - .request_with_config(Method::PUT, path, &config) + .request(Method::PUT, path) .query(&[("partNumber", &part), ("uploadId", upload_id)]) .idempotent(true);