From 6ea394467d6eed0e11958b19c17924b7bb3e557f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 6 Nov 2018 15:09:49 +0000 Subject: [PATCH] if viewer asks for range reply in same format even if its full data --- .../Handlers/GetMesh/GetMeshHandler.cs | 26 ++++++------------- .../Handlers/GetTexture/GetTextureHandler.cs | 23 +++++----------- bin/OpenSimDefaults.ini | 12 ++------- 3 files changed, 16 insertions(+), 45 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index 72769c2e72..506f9d22c8 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs @@ -157,25 +157,14 @@ namespace OpenSim.Capabilities.Handlers int len = end - start + 1; //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); + responsedata["int_response_code"] = + (int)System.Net.HttpStatusCode.PartialContent; + headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, mesh.Data.Length); - if (start == 0 && len == mesh.Data.Length) // well redudante maybe - { - responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK; - responsedata["bin_response_data"] = mesh.Data; - responsedata["int_bytes"] = mesh.Data.Length; - } - else - { - responsedata["int_response_code"] = - (int)System.Net.HttpStatusCode.PartialContent; - headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, - mesh.Data.Length); - - byte[] d = new byte[len]; - Array.Copy(mesh.Data, start, d, 0, len); - responsedata["bin_response_data"] = d; - responsedata["int_bytes"] = len; - } + byte[] d = new byte[len]; + Array.Copy(mesh.Data, start, d, 0, len); + responsedata["bin_response_data"] = d; + responsedata["int_bytes"] = len; } } else @@ -213,6 +202,7 @@ namespace OpenSim.Capabilities.Handlers return responsedata; } + private bool TryParseRange(string header, out int start, out int end) { if (header.StartsWith("bytes=")) diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 2499ce4023..57ec2f5d00 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -249,24 +249,13 @@ namespace OpenSim.Capabilities.Handlers // m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); response["content-type"] = texture.Metadata.ContentType; + response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; + headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); - if (start == 0 && len == texture.Data.Length) // well redudante maybe - { - response["int_response_code"] = (int)System.Net.HttpStatusCode.OK; - response["bin_response_data"] = texture.Data; - response["int_bytes"] = texture.Data.Length; - } - else - { - response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; - headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length); - - byte[] d = new byte[len]; - Array.Copy(texture.Data, start, d, 0, len); - response["bin_response_data"] = d; - response["int_bytes"] = len; - } -// response.Body.Write(texture.Data, start, len); + byte[] d = new byte[len]; + Array.Copy(texture.Data, start, d, 0, len); + response["bin_response_data"] = d; + response["int_bytes"] = len; } } else diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 6429faf31f..23f96d5680 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -57,16 +57,8 @@ ; ## ; Sets the method that OpenSim will use to fire asynchronous - ; events. Valid values are UnsafeQueueUserWorkItem, - ; QueueUserWorkItem, BeginInvoke, SmartThreadPool, and Thread. - ; - ; SmartThreadPool is reported to work well on Mono/Linux, but - ; UnsafeQueueUserWorkItem has been benchmarked with better - ; performance on .NET/Windows - ; - ; UnsafeQueueUserWorkItem refers to the fact that the code creating the event could elevate its security - ; privileges. However, as calling code is trusted anyway this is safe (if you set - ; TrustedBinaries = true in the [XEngine] section then you already have to trust that incoming code for other reasons). + ; events. Valid values are , + ; QueueUserWorkItem, SmartThreadPool, and Thread. async_call_method = SmartThreadPool ; Max threads to allocate on the FireAndForget thread pool