mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
d4b822d697
This commit adds a new package `etag` for dealing with S3 ETags. Even though ETag is often viewed as MD5 checksum of an object, handling S3 ETags correctly is a surprisingly complex task. While it is true that the ETag corresponds to the MD5 for the most basic S3 API operations, there are many exceptions in case of multipart uploads or encryption. In worse, some S3 clients expect very specific behavior when it comes to ETags. For example, some clients expect that the ETag is a double-quoted string and fail otherwise. Non-AWS compliant ETag handling has been a source of many bugs in the past. Therefore, this commit adds a dedicated `etag` package that provides functionality for parsing, generating and converting S3 ETags. Further, this commit removes the ETag computation from the `hash` package. Instead, the `hash` package (i.e. `hash.Reader`) should focus only on computing and verifying the content-sha256. One core feature of this commit is to provide a mechanism to communicate a computed ETag from a low-level `io.Reader` to a high-level `io.Reader`. This problem occurs when an S3 server receives a request and has to compute the ETag of the content. However, the server may also wrap the initial body with several other `io.Reader`, e.g. when encrypting or compressing the content: ``` reader := Encrypt(Compress(ETag(content))) ``` In such a case, the ETag should be accessible by the high-level `io.Reader`. The `etag` provides a mechanism to wrap `io.Reader` implementations such that the `ETag` can be accessed by a type-check. This technique is applied to the PUT, COPY and Upload handlers. |
||
---|---|---|
.. | ||
argon2 | ||
auth | ||
bandwidth | ||
bpool | ||
bucket | ||
certs | ||
cgroup | ||
color | ||
console | ||
csvparser | ||
disk | ||
dsync | ||
ellipses | ||
env | ||
etag | ||
event | ||
handlers | ||
hash | ||
iam/policy | ||
ioutil | ||
licverifier | ||
lock | ||
lsync | ||
madmin | ||
mimedb | ||
mountinfo | ||
net | ||
pubsub | ||
quick | ||
rpc | ||
s3select | ||
safe | ||
smart | ||
sync/errgroup | ||
sys | ||
trace | ||
trie | ||
wildcard | ||
words |