aboutsummaryrefslogtreecommitdiff
path: root/src/api/common/signature/payload.rs
diff options
context:
space:
mode:
authorAlex Auvolat <lx@deuxfleurs.fr>2025-02-18 18:57:50 +0100
committerAlex Auvolat <lx@deuxfleurs.fr>2025-02-18 21:47:53 +0100
commitf6e805e7db7b35e9fc6baaad6ec953e30a443437 (patch)
tree904b5b61d02deb24c20b37c993b080c335d155c5 /src/api/common/signature/payload.rs
parent45e10e55f9761d79aa8d5b7dbaeb56d4d535629e (diff)
downloadgarage-f6e805e7db7b35e9fc6baaad6ec953e30a443437.tar.gz
garage-f6e805e7db7b35e9fc6baaad6ec953e30a443437.zip
api: various fixes
Diffstat (limited to 'src/api/common/signature/payload.rs')
-rw-r--r--src/api/common/signature/payload.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/api/common/signature/payload.rs b/src/api/common/signature/payload.rs
index 4ca0153f..2d5f8603 100644
--- a/src/api/common/signature/payload.rs
+++ b/src/api/common/signature/payload.rs
@@ -74,21 +74,16 @@ fn parse_x_amz_content_sha256(header: Option<&str>) -> Result<ContentSha256Heade
} else {
(false, rest)
};
- if algo == AWS4_HMAC_SHA256_PAYLOAD {
- Ok(ContentSha256Header::StreamingPayload {
- trailer,
- signed: true,
- })
- } else if algo == UNSIGNED_PAYLOAD {
- Ok(ContentSha256Header::StreamingPayload {
- trailer,
- signed: false,
- })
- } else {
- Err(Error::bad_request(
- "invalid or unsupported x-amz-content-sha256",
- ))
- }
+ let signed = match algo {
+ AWS4_HMAC_SHA256_PAYLOAD => true,
+ UNSIGNED_PAYLOAD => false,
+ _ => {
+ return Err(Error::bad_request(
+ "invalid or unsupported x-amz-content-sha256",
+ ))
+ }
+ };
+ Ok(ContentSha256Header::StreamingPayload { trailer, signed })
} else {
let sha256 = hex::decode(header)
.ok()