From 1ee8f596ee6792b987b07dc08617feb4a3480c1a Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 12 Jan 2022 10:17:15 +0100 Subject: Testing for UploadPartCopies and bugfixes in AWS signatures --- src/api/s3_copy.rs | 1 + src/api/signature.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/api') diff --git a/src/api/s3_copy.rs b/src/api/s3_copy.rs index c37bb138..7e91ecd8 100644 --- a/src/api/s3_copy.rs +++ b/src/api/s3_copy.rs @@ -537,6 +537,7 @@ impl CopyPreconditionHeaders { } (None, None, Some(inm), None) => !inm.iter().any(|x| x == etag || x == "*"), (None, None, None, Some(ims)) => v_date > *ims, + (None, None, None, None) => true, _ => { return Err(Error::BadRequest( "Invalid combination of x-amz-copy-source-if-xxxxx headers".into(), diff --git a/src/api/signature.rs b/src/api/signature.rs index c580cb3a..311e6a9a 100644 --- a/src/api/signature.rs +++ b/src/api/signature.rs @@ -266,10 +266,13 @@ fn canonical_header_string(headers: &HashMap, signed_headers: &s let mut items = headers .iter() .filter(|(key, _)| signed_headers_vec.contains(&key.as_str())) - .map(|(key, value)| key.to_lowercase() + ":" + value.trim()) .collect::>(); - items.sort(); - items.join("\n") + items.sort_by(|(k1, _), (k2, _)| k1.cmp(k2)); + items + .iter() + .map(|(key, value)| key.to_lowercase() + ":" + value.trim()) + .collect::>() + .join("\n") } fn canonical_query_string(uri: &hyper::Uri) -> String { -- cgit v1.2.3