Skip to content

Commit

Permalink
Revert "Ignore x-amz-checksum-algorithm when checking for user suppli…
Browse files Browse the repository at this point in the history
…ed checksums."

This reverts commit 93a47eb.
  • Loading branch information
jonathan343 committed Oct 28, 2024
1 parent 93a47eb commit c66fa99
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
2 changes: 1 addition & 1 deletion botocore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@

# This pattern can be used to detect if a header is a flexible checksum header
CHECKSUM_HEADER_PATTERN = re.compile(
r'^x-amz-checksum-(?!algorithm\b)([a-z0-9]*)$',
r'^X-Amz-Checksum-([a-z0-9]*)$',
flags=re.IGNORECASE,
)

Expand Down
22 changes: 0 additions & 22 deletions tests/unit/test_httpchecksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,28 +259,6 @@ def test_request_checksum_algorithm_model_new_crc32(self):
}
self.assertEqual(actual_algorithm, expected_algorithm)

def test_x_amz_checksum_algorithm_header_is_ignored(self):
request = self._build_request(b"")
request["headers"]["x-amz-checksum-algorithm"] = "some_value"
operation_model = self._make_operation_model(
http_checksum={"requestAlgorithmMember": "Algorithm"}
)
params = {}

resolve_request_checksum_algorithm(request, operation_model, params)
self.assertIn("checksum", request["context"])

def test_non_x_amz_checksum_algorithm_header_is_not_ignored(self):
request = self._build_request(b"")
request["headers"]["x-amz-checksum-someChecksum"] = "some_value"
operation_model = self._make_operation_model(
http_checksum={"requestAlgorithmMember": "Algorithm"}
)
params = {}

resolve_request_checksum_algorithm(request, operation_model, params)
self.assertNotIn("checksum", request["context"])

def test_apply_request_checksum_handles_no_checksum_context(self):
request = self._build_request(b"")
apply_request_checksum(request)
Expand Down

0 comments on commit c66fa99

Please sign in to comment.