git.iko.soy/typeable/minio-hs
on master help sign in
Sent Accept-Encoding: identity in the head requests. (#155)

It appeared that some s3 servers (Yandex storage in particular) honour `Accept-Encoding: gzip` request headeer. In such a case servers can't send `Content-Length` header as transfer size differ from the body size. The simplest solution for this problem is to force http-client to send `Accept-Encoding: identity` header in the HeadObject request. Co-authored-by: Aditya Manthramurthy <donatello@users.noreply.github.com>

commit3dd235a1ad1e25b964226112b55a84fd9cdb2d00 authorAlexander Vershilov <alexander.vershilov@gmail.com> dateMon 15 Jun 2020, 20:21 (6 years ago) parent8e5e51c
1 file changed+8−1
src/Network/Minio/S3API.hs+8−1
src/Network/Minio/S3API.hs+8−1
@@ -158,6 +158,10 @@ getObject' bucket object queryParams headers = do
158158 riObject = Just object,
159159 riQueryParams = queryParams,
160160 riHeaders = headers
161+ -- This header is required for safety as otherwise http-client,
162+ -- sends Accept-Encoding: gzip, and the server may actually gzip
163+ -- body. In that case Content-Length header will be missing.
164+ <> [("Accept-Encoding", "identity")]
161165 }
162166
163167-- | Creates a bucket via a PUT bucket call.
@@ -550,8 +554,11 @@ headObject bucket object reqHeaders = do
550554 riBucket = Just bucket,
551555 riObject = Just object,
552556 riHeaders = reqHeaders
557+ -- This header is required for safety as otherwise http-client,
558+ -- sends Accept-Encoding: gzip, and the server may actually gzip
559+ -- body. In that case Content-Length header will be missing.
560+ <> [("Accept-Encoding", "identity")]
553561 }
554−
555562 maybe (throwIO MErrVInvalidObjectInfoResponse) return
556563 $ parseGetObjectHeaders object
557564 $ NC.responseHeaders resp