0

ラックスペース ファイルから openstack SDK を使用してファイルをダウンロードしようとしています。ファイルが既に存在する場合は、範囲ヘッダーを使用して、中断したところから書き込みを続けたいと考えています。彼らのドキュメントによると、これは達成できます。openstack SDK のドキュメントには、範囲ヘッダーを設定できると記載されています。これが私のコードです:

Dictionary<string, string> headers = new Dictionary<string,string>();
        if (File.Exists(@"C:\path\to\file.zip"))
        {
            long iExistLen = 0;
            System.IO.FileInfo fINfo =
              new System.IO.FileInfo(@"C:\path\to\file.zip");
            iExistLen = fINfo.Length;

            headers.Add("Range", "bytes="+iExistLen+"-");
        }

        CloudIdentity cloudIdentity = new CloudIdentity()
        {
            APIKey = apikey,
            Username = username
        };

        CloudFilesProvider cloudFilesProvider = new CloudFilesProvider(cloudIdentity);
        cloudFilesProvider.GetObjectSaveToFile(containerName, @"C:\path\to\", fileName, "file.zip", 65536, headers);

これを実行すると、次のエラーが表示されます。

The 'Range' header must be modified using the appropriate property or method.

どんな助けでも大歓迎です。

ありがとう。

4

1 に答える 1

0

一部の一般的なヘッダーは制限されていると見なされ、API (Content-Type など) によって直接公開されるか、システムによって保護され、変更できません。Rangeはそのヘッダーの 1 つです。完全なリストは次のとおりです。

Accept
Connection
Content-Length
Content-Type
Date
Expect
Host
If-Modified-Since
Range
Referer
Transfer-Encoding
User-Agent
Proxy-Connection
于 2014-11-18T18:25:18.323 に答える