mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(s3): omit whole-object checksum headers on range responses (#1040)
PR #923 routed handleRangeRequest through appendObjectHeaders so 206 partial-content responses would pick up stored headers and response-* overrides. That also pulled in appendChecksumHeaders, which emits obj.getChecksum() — the whole-object checksum — onto partial responses. SDKs that validate the checksum against the received body then fail, e.g. a `bytes=4-7` GET returns the full-object CRC64NVME and the AWS CLI reports: Expected checksum CRSFynAYcw4= did not match calculated checksum: LQYlQwQYKmA= Real S3 does not return whole-object checksum headers on ranged responses. Add an includeChecksum flag to appendObjectHeaders (defaults true for the existing GET/HEAD callers) and pass false from handleRangeRequest. The override + restored-header improvements from #923 are unaffected. Reported by @dwhjames on #923.
This commit is contained in:
1 parent
ad02786b8a
commit
25d6988950
2 files changed
+31
-2
No files matched your search
@@ -572,6 +572,24 @@ class S3IntegrationTest {
|
||||
.header("Accept-Ranges", equalTo("bytes"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(40)
|
||||
void getObjectRangeOmitsWholeObjectChecksum() {
|
||||
// greeting.txt has a stored whole-object CRC64NVME checksum (see getObject).
|
||||
// A 206 partial response must NOT carry that checksum: it is computed over the
|
||||
// full object, so SDKs that validate it against the received range bytes fail.
|
||||
// Real S3 omits whole-object checksum headers on ranged responses.
|
||||
given()
|
||||
.header("Range", "bytes=4-7")
|
||||
.when()
|
||||
.get("/test-bucket/greeting.txt")
|
||||
.then()
|
||||
.statusCode(206)
|
||||
.header("Content-Range", equalTo("bytes 4-7/20"))
|
||||
.body(equalTo("o Wo"))
|
||||
.header("x-amz-checksum-crc64nvme", nullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(50)
|
||||
void getObjectIfNoneMatchReturns304() {
|
||||
|
||||
Reference in new issue
Block a user