From fe9df5541097c44168bc2a4c60f4cb03cdf91aac Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 2 Apr 2020 21:52:31 +0100 Subject: [PATCH] nissing files --- .../FetchInventory/FetchInventory2Handler.cs | 2 +- .../Handlers/GetAssets/GetAssetsHandler.cs | 33 ++++++++----------- .../GetTexture/GetTextureRobustHandler.cs | 27 ++++++++------- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index e25ead45fa..53bffd52ac 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs @@ -105,7 +105,7 @@ namespace OpenSim.Capabilities.Handlers } LLSDxmlEncode.AddEndMap(lsl); - return LLSDxmlEncode.End(lsl);; + return LLSDxmlEncode.End(lsl); } } } diff --git a/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs b/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs index 66fc54e0bb..61700dd5b6 100644 --- a/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs @@ -137,27 +137,13 @@ namespace OpenSim.Capabilities.Handlers return responsedata; } - if (type == AssetType.Mesh || type == AssetType.Texture) - { - responsedata["throttle"] = true; - responsedata["prio"] = 2; - } - - responsedata["content_type"] = asset.Metadata.ContentType; - responsedata["bin_response_data"] = asset.Data; - responsedata["int_bytes"] = asset.Data.Length; - responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK; + int len = asset.Data.Length; string range = String.Empty; if (((Hashtable)request["headers"])["range"] != null) range = (string)((Hashtable)request["headers"])["range"]; else if (((Hashtable)request["headers"])["Range"] != null) range = (string)((Hashtable)request["headers"])["Range"]; - else - return responsedata; // full asset - - if (String.IsNullOrEmpty(range)) - return responsedata; // full asset // range request int start, end; @@ -177,7 +163,7 @@ namespace OpenSim.Capabilities.Handlers end = Utils.Clamp(end, 0, asset.Data.Length - 1); start = Utils.Clamp(start, 0, end); - int len = end - start + 1; + len = end - start + 1; //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); Hashtable headers = new Hashtable(); @@ -185,12 +171,19 @@ namespace OpenSim.Capabilities.Handlers responsedata["headers"] = headers; responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; responsedata["bin_start"] = start; - responsedata["int_bytes"] = len; - return responsedata; } + else + responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK; - m_log.Warn("[GETASSETS]: Failed to parse a range, sending full asset: " + assetStr); - return responsedata; + responsedata["content_type"] = asset.Metadata.ContentType; + responsedata["bin_response_data"] = asset.Data; + responsedata["int_bytes"] = len; + if (type == AssetType.Mesh || type == AssetType.Texture) + { + responsedata["throttle"] = true; + responsedata["prio"] = len < 8196 ? 1 : 2; + } + return responsedata; // full asset } } } \ No newline at end of file diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs index a9b3d48694..2c1ba03ae1 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs @@ -137,7 +137,7 @@ namespace OpenSim.Capabilities.Handlers string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString(); m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl); httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently; - httpResponse.RedirectLocation = textureUrl; + httpResponse.AddHeader("Location:", textureUrl); return true; } @@ -238,8 +238,9 @@ namespace OpenSim.Capabilities.Handlers response.ContentLength = len; response.ContentType = texture.Metadata.ContentType; response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); - - response.Body.Write(texture.Data, start, len); + response.RawBuffer = texture.Data; + response.RawBufferStart = start; + response.RawBufferLen = len; } } else @@ -257,17 +258,19 @@ namespace OpenSim.Capabilities.Handlers response.ContentType = texture.Metadata.ContentType; else response.ContentType = "image/" + format; - response.Body.Write(texture.Data, 0, texture.Data.Length); + response.RawBuffer = texture.Data; + response.RawBufferStart = 0; + response.RawBufferLen = texture.Data.Length; } -// if (response.StatusCode < 200 || response.StatusCode > 299) -// m_log.WarnFormat( -// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", -// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); -// else -// m_log.DebugFormat( -// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", -// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); + // if (response.StatusCode < 200 || response.StatusCode > 299) + // m_log.WarnFormat( + // "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", + // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); + // else + // m_log.DebugFormat( + // "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", + // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); } ///