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:
Alexander Vershilov 2020-06-15 20:21:41 +03:00 committed by GitHub
parent 8e5e51ceb8
commit 3dd235a1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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