我无法弄清楚为什么我一直从AWS Glacier获取无效的内容范围。它看起来像我的格式遵循RFC 2616但我一直收到错误。帮助
以下是代码:
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);
}
}
答案 0 :(得分:3)
显然我误解了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/*.
你不应该包含标题本身的名称,所以这一行:
string Range = "Content-Range:bytes " + FileStream.Position.ToString() + "-" + (FileStream.Position + Size - 1).ToString() + "/*";
应该是:
string Range = "bytes " + FileStream.Position.ToString() + "-" + (FileStream.Position + Size - 1).ToString() + "/*";
DERP。