Closed harshanandmv closed 8 years ago
Shoot, looks like this is a bug in SimpleRESTServices, a dependency that I have been trying to deprecate but CloudFiles still uses it.
Let me see if I can work out a fix for that dependency and get that baked into a patch build of openstack.net... If I can't get it fixed, I can at least provide the pure C# code to make this one call.
This has been fixed in https://github.com/openstacknetsdk/SimpleRestServices/commit/252e4d2824411df1052b2598108057f9ce238086. Update to OpenStack.NET 1.7.4 to get the fix.
Here's a quick example of how to pass in a range header:
var cloudfiles = new CloudFilesProvider(user);
var headers = new Dictionary<string, string>();
headers.Add("Range", "bytes=0-4");
using (var buffer = new MemoryStream())
{
cloudfiles.GetObject("test", "helloworld.html", buffer, 4096, headers, region);
using (var reader = new StreamReader(buffer))
{
buffer.Position = 0;
Console.WriteLine("Read: {0}", reader.ReadToEnd());
// Read: hello
}
}
Thanks for the bug report!
Thanks @carolynvs ... You're awesome!!!!
I am able to get the entire file using CloudFilesProvider.GetObject. But not able to pass in a range to retrieve part of that object. Its supported by Swift, but the SDK doesnt support it.
System.IO.Stream stream = new System.IO.MemoryStream(110); Dictionary<string, string> headers = new Dictionary<string,string>();
cloudFilesProvider.GetObject("images", "test.jpg", stream, 4096, headers, region, false, null, false, null);
I get a System.ArgumentException with "The 'Range' header must be modified using the appropriate property or method."
Can someone help?