From 06d3a529a9ea31de997f187bfa6a646e25b7a1cf Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 9 Oct 2010 17:46:09 +0200 Subject: In case when 1 single byte is requested (yes viewer does this) start of the ranges gets clamped with a wrong value. In case of a texture with 601 byte long texture the viewer request range 0-599 first, then 600- in which case both start and end should be 600. End can also be 0, valid request for the firt byte of the file is 0-0. Thanks to Thickbrick for explaining how HTTP range header works. --- OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index a3238df..d564ee6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -187,8 +187,8 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps int start, end; if (TryParseRange(range, out start, out end)) { - end = Utils.Clamp(end, 1, texture.Data.Length - 1); - start = Utils.Clamp(start, 0, end - 1); + end = Utils.Clamp(end, 0, texture.Data.Length - 1); + start = Utils.Clamp(start, 0, end); int len = end - start + 1; //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); -- cgit v1.1 From 5e381ec67c1a8d108fced63b76ae44eeb70aa38e Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 9 Oct 2010 18:01:11 +0200 Subject: Return error code instead of the last byte of the file if range is not satisfiable --- OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index d564ee6..6545be7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -186,7 +186,15 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps // Range request int start, end; if (TryParseRange(range, out start, out end)) - { + { + // Before clamping end make sure we can satisfy it in order to avoid + // sending back the last byte instead of an error status + if (end >= texture.Data.Length) + { + response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; + return; + } + end = Utils.Clamp(end, 0, texture.Data.Length - 1); start = Utils.Clamp(start, 0, end); int len = end - start + 1; -- cgit v1.1 From 3454dfbcb3f76375ad5d98249a3cde27e5e5b250 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 9 Oct 2010 12:07:58 -0400 Subject: weird line endings fix commit --- .../Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 6545be7..38151b1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -186,13 +186,13 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps // Range request int start, end; if (TryParseRange(range, out start, out end)) - { - // Before clamping end make sure we can satisfy it in order to avoid - // sending back the last byte instead of an error status - if (end >= texture.Data.Length) - { - response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; - return; + { + // Before clamping end make sure we can satisfy it in order to avoid + // sending back the last byte instead of an error status + if (end >= texture.Data.Length) + { + response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; + return; } end = Utils.Clamp(end, 0, texture.Data.Length - 1); -- cgit v1.1 From 0dd4071156bc5def8bb8f6bb54051aa6198f1186 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 9 Oct 2010 18:22:21 +0200 Subject: Fix a typo in previouis commit: start must not pass the end of the file --- OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 38151b1..97581e5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -187,9 +187,9 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps int start, end; if (TryParseRange(range, out start, out end)) { - // Before clamping end make sure we can satisfy it in order to avoid + // Before clamping start make sure we can satisfy it in order to avoid // sending back the last byte instead of an error status - if (end >= texture.Data.Length) + if (start >= texture.Data.Length) { response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; return; -- cgit v1.1 From cf61cf7b323b433adb77517989659278fa4a541e Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 9 Oct 2010 13:50:53 -0400 Subject: * Make line endings consistant in Meshmerizer.cs --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index c97db8c..cf57c0a 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.Physics.Meshing { IConfig start_config = config.Configs["Startup"]; - decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); + decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); try -- cgit v1.1