@@ -215,7 +215,7 @@ extension AWSHTTPRequest {
215215 if Input . _options. contains ( . checksumRequired)
216216 || ( Input . _options. contains ( . md5ChecksumHeader) && configuration. options. contains ( . calculateMD5) )
217217 {
218- checksumType = . md5
218+ checksumType = . defaultMD5
219219 }
220220 }
221221
@@ -247,7 +247,9 @@ extension AWSHTTPRequest {
247247 checksum = self . calculateChecksum ( buffer, function: Insecure . SHA1. self)
248248 case . sha256:
249249 checksum = self . calculateChecksum ( buffer, function: SHA256 . self)
250- case . md5:
250+ case . sha512:
251+ checksum = self . calculateChecksum ( buffer, function: SHA512 . self)
252+ case . md5, . defaultMD5:
251253 checksum = self . calculateChecksum ( buffer, function: Insecure . MD5. self)
252254 }
253255 if let checksum {
@@ -300,15 +302,22 @@ extension AWSHTTPRequest {
300302 case crc32c = " CRC32C "
301303 case sha1 = " SHA1 "
302304 case sha256 = " SHA256 "
305+ case sha512 = " SHA512 "
303306 case md5 = " MD5 "
307+ case defaultMD5 = " _default_md5_ "
304308 }
305309
310+ // TODO: this should really be defined in the shape files but so far we only have S3 using checksums and
311+ // these are it defined headers
306312 private static let checksumHeaders : [ ChecksumType : String ] = [
307313 . crc32: " x-amz-checksum-crc32 " ,
308314 . crc32c: " x-amz-checksum-crc32c " ,
309315 . sha1: " x-amz-checksum-sha1 " ,
310316 . sha256: " x-amz-checksum-sha256 " ,
311- . md5: " content-md5 " ,
317+ . sha512: " x-amz-checksum-sha512 " ,
318+ . md5: " x-amz-checksum-md5 " ,
319+ // default to content-md5 header if no algorithm header is found and a checksum is required
320+ . defaultMD5: " content-md5 " ,
312321 ]
313322}
314323
0 commit comments