mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 22:37:55 -05:00
S3 takes at most 5 GB in one PutObject and 5 GiB in one part (User Guide, "Uploading objects" and the multipart upload limits table), but Floci only enforced that for UploadPartCopy. Since PutObject and UploadPart stream to disk, the only cap was FLOCI_PROTOCOLS_MAX_REQUEST_SIZE, so raising it past 5120 MB, as docs/services/s3.md says to for 5 GiB uploads, let a single request store any size up to the new limit. A request that declares more than 5 GiB of data, in Content-Length or, for an aws-chunked body, x-amz-decoded-content-length (its Content-Length also counts the framing), now fails with EntityTooLarge before any of its body is read. A body that declares no size, or less than it sends, fails the same way once it passes 5 GiB: the stream that digests a body on its way to disk counts it against the limit, while memory mode already stops at about 2 GiB. PutObject's "5 GB" is taken as 5 GiB, as CopyObject's is. The error is now the one S3 sends, as S3's answer to an oversized UploadPart logged in aws/aws-cli#5420 and an AWS-validated LocalStack capture record it: the message "Your proposed upload exceeds the maximum allowed size", not the error table's description, and the ProposedSize and MaxSizeAllowed fields, ProposedSize left out when a body passes the limit as it is read, since its whole size is then not known. It is built in one place and shared with UploadPartCopy and the memory-mode cap, which sent the table's wording and named neither size; the memory-mode cap names the most memory mode can hold. A client that sent Expect: 100-continue never sends a body it was not told to continue with, so answering it before reading the body left the connection waiting for that body and reading the client's next request as it (#5291). Such an answer now says Connection: close and the connection is closed after it, which covers this rejection as well as NoSuchBucket or a failed precondition. An aws-chunked body sent without a streaming x-amz-content-sha256 or an x-amz-trailer is read whole to be decoded. That read now fails with EntityTooLarge once it passes what one array holds, through the bounded read memory mode uses, instead of running the heap out of memory. Telling an aws-chunked body from its Content-Encoding is now one helper, which the four places that repeated the check use too.