diff options
author | ubit | 2013-04-28 20:40:11 +0200 |
---|---|---|
committer | ubit | 2013-04-28 20:40:11 +0200 |
commit | 61ea7ee5a94e5e3d33fc77c1c316318850309c42 (patch) | |
tree | 1e589fc3b448b580d1cc25b52215ef5ce2d7ae78 /OpenSim/Capabilities | |
parent | Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | Controller module for dynamic floaters (WIP) (diff) | |
download | opensim-SC-61ea7ee5a94e5e3d33fc77c1c316318850309c42.zip opensim-SC-61ea7ee5a94e5e3d33fc77c1c316318850309c42.tar.gz opensim-SC-61ea7ee5a94e5e3d33fc77c1c316318850309c42.tar.bz2 opensim-SC-61ea7ee5a94e5e3d33fc77c1c316318850309c42.tar.xz |
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Conflicts:
bin/Regions/Regions.ini.example
Diffstat (limited to 'OpenSim/Capabilities')
4 files changed, 38 insertions, 5 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 68686c5..aa6203b 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -240,6 +240,11 @@ namespace OpenSim.Capabilities.Handlers | |||
240 | } | 240 | } |
241 | else | 241 | else |
242 | { | 242 | { |
243 | // Handle the case where no second range value was given. This is equivalent to requesting | ||
244 | // the rest of the entity. | ||
245 | if (end == -1) | ||
246 | end = int.MaxValue; | ||
247 | |||
243 | end = Utils.Clamp(end, 0, texture.Data.Length - 1); | 248 | end = Utils.Clamp(end, 0, texture.Data.Length - 1); |
244 | start = Utils.Clamp(start, 0, end); | 249 | start = Utils.Clamp(start, 0, end); |
245 | int len = end - start + 1; | 250 | int len = end - start + 1; |
@@ -298,15 +303,43 @@ namespace OpenSim.Capabilities.Handlers | |||
298 | // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); | 303 | // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); |
299 | } | 304 | } |
300 | 305 | ||
306 | /// <summary> | ||
307 | /// Parse a range header. | ||
308 | /// </summary> | ||
309 | /// <remarks> | ||
310 | /// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, | ||
311 | /// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-). | ||
312 | /// Where there is no value, -1 is returned. | ||
313 | /// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1 | ||
314 | /// for start.</remarks> | ||
315 | /// <returns></returns> | ||
316 | /// <param name='header'></param> | ||
317 | /// <param name='start'>Start of the range. Undefined if this was not a number.</param> | ||
318 | /// <param name='end'>End of the range. Will be -1 if no end specified. Undefined if there was a raw string but this was not a number.</param> | ||
301 | private bool TryParseRange(string header, out int start, out int end) | 319 | private bool TryParseRange(string header, out int start, out int end) |
302 | { | 320 | { |
321 | start = end = 0; | ||
322 | |||
303 | if (header.StartsWith("bytes=")) | 323 | if (header.StartsWith("bytes=")) |
304 | { | 324 | { |
305 | string[] rangeValues = header.Substring(6).Split('-'); | 325 | string[] rangeValues = header.Substring(6).Split('-'); |
326 | |||
306 | if (rangeValues.Length == 2) | 327 | if (rangeValues.Length == 2) |
307 | { | 328 | { |
308 | if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end)) | 329 | if (!Int32.TryParse(rangeValues[0], out start)) |
330 | return false; | ||
331 | |||
332 | string rawEnd = rangeValues[1]; | ||
333 | |||
334 | if (rawEnd == "") | ||
335 | { | ||
336 | end = -1; | ||
337 | return true; | ||
338 | } | ||
339 | else if (Int32.TryParse(rawEnd, out end)) | ||
340 | { | ||
309 | return true; | 341 | return true; |
342 | } | ||
310 | } | 343 | } |
311 | } | 344 | } |
312 | 345 | ||
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs index b6ae41b..217a265 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs | |||
@@ -43,7 +43,7 @@ using OpenSim.Tests.Common.Mock; | |||
43 | namespace OpenSim.Capabilities.Handlers.GetTexture.Tests | 43 | namespace OpenSim.Capabilities.Handlers.GetTexture.Tests |
44 | { | 44 | { |
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class GetTextureHandlerTests | 46 | public class GetTextureHandlerTests : OpenSimTestCase |
47 | { | 47 | { |
48 | [Test] | 48 | [Test] |
49 | public void TestTextureNotFound() | 49 | public void TestTextureNotFound() |
diff --git a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs index a681fb6..f8f63f4 100644 --- a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs +++ b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.5.*")] | 32 | [assembly: AssemblyVersion("0.7.6.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | |
diff --git a/OpenSim/Capabilities/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Properties/AssemblyInfo.cs index 26254f2..f8a9dae 100644 --- a/OpenSim/Capabilities/Properties/AssemblyInfo.cs +++ b/OpenSim/Capabilities/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.5.*")] | 32 | [assembly: AssemblyVersion("0.7.6.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |