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>
This commit is contained in:
parent
8e5e51ceb8
commit
3dd235a1ad
@ -158,6 +158,10 @@ getObject' bucket object queryParams headers = do
|
||||
riObject = Just object,
|
||||
riQueryParams = queryParams,
|
||||
riHeaders = headers
|
||||
-- This header is required for safety as otherwise http-client,
|
||||
-- sends Accept-Encoding: gzip, and the server may actually gzip
|
||||
-- body. In that case Content-Length header will be missing.
|
||||
<> [("Accept-Encoding", "identity")]
|
||||
}
|
||||
|
||||
-- | Creates a bucket via a PUT bucket call.
|
||||
@ -550,8 +554,11 @@ headObject bucket object reqHeaders = do
|
||||
riBucket = Just bucket,
|
||||
riObject = Just object,
|
||||
riHeaders = reqHeaders
|
||||
-- This header is required for safety as otherwise http-client,
|
||||
-- sends Accept-Encoding: gzip, and the server may actually gzip
|
||||
-- body. In that case Content-Length header will be missing.
|
||||
<> [("Accept-Encoding", "identity")]
|
||||
}
|
||||
|
||||
maybe (throwIO MErrVInvalidObjectInfoResponse) return
|
||||
$ parseGetObjectHeaders object
|
||||
$ NC.responseHeaders resp
|
||||
|
||||
Loading…
Reference in New Issue
Block a user