...
Content-MD5 checksums provide an end-to-end message integrity check of the content (excluding metadata) as it is sent to and returned from Swarm. A proxy or client can check the Content-MD5 header to detect modifications to the entity-body while in transit. Additionally, a A client can provide this header to indicate that Swarm should compute and check it as it is storing or returning the object data.
...
Another way to associate a Content-MD5 value with an object is to have Swarm compute the ContentMD5 for the body data of the request. To do this, include the gencontentmd5 query argument in the request. Swarm will return returns the Content-MD5 as a header in the 201 Created response. Once computed, the Content-MD5 data is stored with the object and returned as a response header for any subsequent GET or HEAD requests. Note that the gencontentmd5 query argument replaces use of the "Expect: Content-MD5" request header, which is deprecated per RFC 2731. (v9.2)
Info |
---|
TipThe Swarm setting scsp.autoContentMD5Computation automates Content-MD5 hashing. The gencontentmd5 query argument or the deprecated Expect: Content-MD5 header on writes does not need to be included (although a separate Content-MD5 header may want to be supplied for content integrity checking). This setting is ignored wherever it is invalid, such as on a multipart initiate/complete or an EC APPEND. (v9.1) |
Ranges - When you include including ?gencontentmd5 on a GET request with a Range header, any Content-MD5 header stored with the object will be is omitted in the response headers. Instead, a Content-MD5 of the selected range will be is returned as a trailing header to the GET request.
...
Info |
---|
Validation failuresBecause of the way that Swarm reports a hash validation failure, SCSP reading operations that request a Content-MD5 hash validation and for which there is a hash mismatch will cause causes a storage node to be removed for the Gateway's connection pool temporarily. |
...
Content-MD5 and Replication
When you provide providing the gencontentmd5 query argument in a request on a replicated object, the following applies:
On a write request (POST, PUT, COPY, or APPEND), the Content-MD5 is calculated, stored with the object, and returned as a response header for that write operation.
The Content-MD5 is always returned for any GET or HEAD request that was written with the gencontentmd5 query argument.
When you include including ?gencontentmd5 on a range read (a GET request with the Range header), Swarm will suppress suppresses any stored Content-MD5 from the response headers and instead return a Content-MD5 for the requested range as a trailing header.
Content-MD5 and Erasure-Coding
When you provide providing the gencontentmd5 query argument in request on an erasure-coded object, the following applies:
The APPEND operation is no longer supported. If you provide providing a gencontentmd5 query argument on an APPEND, it returns a 400 Bad Request error response.
The COPY operation is only supported if you provided providing a gencontentmd5 query argument on the existing object's write. Otherwise the COPY operation fails.
For a range read (a GET request with the Range header), Swarm will suppress suppresses any stored Content-MD5 from the response headers and instead return a Content-MD5 for the requested range as a trailing header.