aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/chunked_reader_v4.go
diff options
context:
space:
mode:
authorTom Crasset <25140344+tcrasset@users.noreply.github.com>2025-02-07 19:54:31 +0100
committerGitHub <noreply@github.com>2025-02-07 10:54:31 -0800
commita7b964af96cd6bc07fc89571cc5f3f8048464cb3 (patch)
tree8d88b37154f72da6b101a6f1def1eff7a2092bd7 /weed/s3api/chunked_reader_v4.go
parente8d8bfccccc666bbef4f1019f880e9aed5aea668 (diff)
downloadseaweedfs-a7b964af96cd6bc07fc89571cc5f3f8048464cb3.tar.xz
seaweedfs-a7b964af96cd6bc07fc89571cc5f3f8048464cb3.zip
add s3 signature tests and prepare implementation of STREAMING-UNSIGNED-PAYLOAD-TRAILER (#6525)
* add tests for s3 signature * add test for newSignV4ChunkedReader.Read() * add glog import
Diffstat (limited to 'weed/s3api/chunked_reader_v4.go')
-rw-r--r--weed/s3api/chunked_reader_v4.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/weed/s3api/chunked_reader_v4.go b/weed/s3api/chunked_reader_v4.go
index 4bf74d025..a646e8875 100644
--- a/weed/s3api/chunked_reader_v4.go
+++ b/weed/s3api/chunked_reader_v4.go
@@ -29,6 +29,7 @@ import (
"net/http"
"time"
+ "github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
@@ -54,14 +55,21 @@ func (iam *IdentityAccessManagement) calculateSeedSignature(r *http.Request) (cr
return nil, "", "", time.Time{}, errCode
}
- // Payload streaming.
- payload := streamingContentSHA256
+ contentSha256Header := req.Header.Get("X-Amz-Content-Sha256")
+ switch contentSha256Header {
// Payload for STREAMING signature should be 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD'
- if payload != req.Header.Get("X-Amz-Content-Sha256") {
+ case streamingContentSHA256:
+ glog.V(3).Infof("streaming content sha256")
+ case streamingUnsignedPayload:
+ glog.V(3).Infof("streaming unsigned payload")
+ default:
return nil, "", "", time.Time{}, s3err.ErrContentSHA256Mismatch
}
+ // Payload streaming.
+ payload := contentSha256Header
+
// Extract all the signed headers along with its values.
extractedSignedHeaders, errCode := extractSignedHeaders(signV4Values.SignedHeaders, r)
if errCode != s3err.ErrNone {