gpt4 book ai didi

c# - 继续从 AWS Glacier Multipart Upload 获得 "Invalid Content-Range"响应

转载 作者:行者123 更新时间:2023-11-30 22:17:01 25 4
gpt4 key购买 nike

我不明白为什么我总是从 AWS Glacier 获取无效的内容范围。在我看来,我的格式遵循 RFC 2616,但我一直收到错误消息。帮忙?

enter image description here

代码如下:

using (var FileStream = new System.IO.FileStream(ARCHIVE_FILE, FileMode.Open))
{
while (FileStream.Position < FileInfo.Length)
{
string Range = "Content-Range:bytes " + FileStream.Position.ToString() + "-" + (FileStream.Position + Size - 1).ToString() + "/*";

var request = new Amazon.Glacier.Model.UploadMultipartPartRequest()
{
AccountId = "-",
VaultName = VAULT_NAME,
Body = Amazon.Glacier.GlacierUtils.CreatePartStream(FileStream, Size),
UploadId = UploadId,
Range = Range,
StreamTransferProgress = Progress
};
//request.SetRange(FileStream.Position, FileStream.Position + Size - 1);
response = GlacierClient.UploadMultipartPart(request);
}
}

最佳答案

显然我误解了 Intellisense 描述:

//
// Summary:
// Identifies the range of bytes in the assembled archive that will be uploaded
// in this part. Amazon Glacier uses this information to assemble the archive
// in the proper sequence. The format of this header follows RFC 2616. An example
// header is Content-Range:bytes 0-4194303/*.

您不应该包含 header 本身的名称,因此这一行:

string Range = "Content-Range:bytes " + FileStream.Position.ToString() + "-" + (FileStream.Position + Size - 1).ToString() + "/*";

应该是:

string Range = "bytes " + FileStream.Position.ToString() + "-" + (FileStream.Position + Size - 1).ToString() + "/*";

德普。

关于c# - 继续从 AWS Glacier Multipart Upload 获得 "Invalid Content-Range"响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16991509/

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