Skip to content

Always add Content-Md5 header #750

Description

@stanhu

Currently Content-Md5 is always added to mutlipart uploads (unless disable_content_md5_validation is enabled), but it is only added if the client manually adds the content_md5 option.

This is a bit annoying for several reasons:

  1. A Fog client that uses Google must consider AWS-specific options and manually compute the MD5 checksum.
  2. If AWS Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) is enabled, uploads will fail outright if Content-Md5 is not provided:
Excon::Error::BadRequest: Expected(200) <=> Actual(400 Bad Request)
excon.error.response
  :body              => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidRequest</Code><Message>Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters</Message><RequestId>C7H4DABRG21TNJ0D</RequestId><HostId>O+9dQHb2K9hRWofRK7OgsrsBMg/O965PJ0KFZzY8pXU4fujkB1erBm4Rk51tAlYsMrMa5DAMwsvnHq76UPyCW8UcGnfVIZ47t1ZCUiGMgzg=</HostId></Error>"

FYI, AWS recently default enabled CRC32 checksums in the Go SDK (aws/aws-sdk-go-v2#2960), but this has caused problems with third-party providers.

I propose that there be an option to configure fog-aws to enable MD5 checksums for PutObject requests by default.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions