mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
s3: accept x-amz-checksum-mode from the query string, case-insensitively
Presigned HeadObject/GetObject requests hoist x-amz-checksum-mode into the signed query string, so a strict header-only check would withhold stored checksums on presigned reads that AWS honors.
This commit is contained in:
@@ -87,6 +87,7 @@ const (
|
||||
AmzTrailer = "X-Amz-Trailer"
|
||||
AmzSdkChecksumAlgorithm = "X-Amz-Sdk-Checksum-Algorithm"
|
||||
AmzChecksumType = "X-Amz-Checksum-Type"
|
||||
AmzChecksumMode = "X-Amz-Checksum-Mode"
|
||||
|
||||
// S3 checksum type values (x-amz-checksum-type). A COMPOSITE checksum is a
|
||||
// checksum-of-per-part-checksums ("base64-N"); a FULL_OBJECT checksum is the
|
||||
|
||||
@@ -2238,7 +2238,7 @@ func (s3a *S3ApiServer) setResponseHeaders(w http.ResponseWriter, r *http.Reques
|
||||
// 2. The response covers the full object (no Range header, no partNumber)
|
||||
// The stored checksum covers the full object; returning it for partial
|
||||
// responses causes SDK checksum validation failures.
|
||||
if r != nil && r.Header.Get("X-Amz-Checksum-Mode") == "ENABLED" && r.Header.Get("Range") == "" && requestedPartNumber(r) == 0 {
|
||||
if r != nil && strings.EqualFold(lookupHeaderOrQuery(r, parseRequestQuery(r), s3_constants.AmzChecksumMode), "ENABLED") && r.Header.Get("Range") == "" && requestedPartNumber(r) == 0 {
|
||||
if entry.Extended != nil {
|
||||
if algoName, ok := entry.Extended[s3_constants.ExtChecksumAlgorithm]; ok {
|
||||
if checksumVal, ok := entry.Extended[s3_constants.ExtChecksumValue]; ok {
|
||||
|
||||
Reference in New Issue
Block a user