-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
120 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/checksum_algorithm.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
module Aws | ||
module S3 | ||
module Plugins | ||
# @api private | ||
class ChecksumAlgorithm < Seahorse::Client::Plugin | ||
|
||
# S3 GetObject results for whole Multipart Objects contain a checksum | ||
# that cannot be validated. These should be skipped by the | ||
# ChecksumAlgorithm plugin. | ||
class SkipWholeMultipartGetChecksumsHandler < Seahorse::Client::Handler | ||
def call(context) | ||
context[:http_checksum] ||= {} | ||
context[:http_checksum][:skip_on_suffix] = true | ||
|
||
@handler.call(context) | ||
end | ||
end | ||
|
||
# create_multipart_upload is not modeled with httpChecksum. For | ||
# multipart requests, we must set a default for the checksum algorithm | ||
# for it to f unction. | ||
class DefaultMultipartChecksumHandler < Seahorse::Client::Handler | ||
def call(context) | ||
default = Aws::Plugins::ChecksumAlgorithm::DEFAULT_CHECKSUM | ||
context.params[:checksum_algorithm] ||= default | ||
@handler.call(context) | ||
end | ||
end | ||
|
||
def add_handlers(handlers, _config) | ||
handlers.add( | ||
SkipWholeMultipartGetChecksumsHandler, | ||
step: :initialize, | ||
operations: [:get_object] | ||
) | ||
|
||
handlers.add( | ||
DefaultMultipartChecksumHandler, | ||
step: :initialize, | ||
operations: [:create_multipart_upload] | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
31 changes: 0 additions & 31 deletions
31
gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters