簡體   English   中英

OpenStack SDK GetObjectSaveToFile標頭

[英]OpenStack SDK GetObjectSaveToFile Headers

我正在嘗試從機架文件中使用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.

任何幫助表示贊賞。

謝謝。

一些常見的標頭被認為是受限制的,或者直接由API(例如Content-Type)公開,或者由系統保護,並且無法更改。 Range是該標頭之一。 完整列表是:

Accept
Connection
Content-Length
Content-Type
Date
Expect
Host
If-Modified-Since
Range
Referer
Transfer-Encoding
User-Agent
Proxy-Connection

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM