gpt4 book ai didi

swift - AWS S3 签名的 UploadPart header 的 Content-MD5

转载 作者:行者123 更新时间:2023-11-30 10:50:52 24 4
gpt4 key购买 nike

使用 AWS MultipartUpload 上传部分时,如果添加 md5 header ,则会失败。谁能告诉我我是否正确计算了校验和?

现在我只是使用 CryptoSwift 并以这种方式获取它

data.md5().base64EncodedString()

数据是我上传的内容

Alamofire.upload(
data,
to: presignedMultipartLink,
method: Alamofire.HTTPMethod.put,
headers: [
"Content-Length": sizeOfPart,
"Content-MD5": data.md5().base64EncodedString()
])
.uploadProgress{...}
.response{...}

如果我取出 Content-MD5 header ,它就会按预期工作。

xml响应是,那么如何添加md5头呢?

<Error><Code>AccessDenied</Code><Message>There were headers present in the request which were not signed</Message><HeadersNotSigned>content-md5</HeadersNotSigned><RequestId>requestid</RequestId><HostId>hostid</HostId></Error>

最佳答案

我需要将其作为参数包含在 getPresignedUrl 调用中。否则不能包含在内。呸……那些日子之一。

关于swift - AWS S3 签名的 UploadPart header 的 Content-MD5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54566529/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com