From 9a042696440e7dd9502f78b80ae8441642912dd3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 16:49:39 +0100 Subject: fix GetTextureHandler range --- OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Capabilities/Handlers') diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 4e755aa..0df16d6 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -187,7 +187,11 @@ namespace OpenSim.Capabilities.Handlers response["headers"] = headers; string range = String.Empty; - if (((Hashtable)request["headers"])["Range"] != null) + + 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"]; if (!String.IsNullOrEmpty(range)) // JP2's only -- cgit v1.1 From a70352db17a26eb01fea30eb6a7d6159d52a4916 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 21:03:31 +0100 Subject: don't send a partial contents report if we are sending all data --- .../Handlers/GetTexture/GetTextureHandler.cs | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'OpenSim/Capabilities/Handlers') diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 0df16d6..b3a4d61 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -217,17 +217,22 @@ namespace OpenSim.Capabilities.Handlers //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); - // Always return PartialContent, even if the range covered the entire data length - // We were accidentally sending back 404 before in this situation - // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the - // entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this. - response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent; response["content-type"] = texture.Metadata.ContentType; - 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; + + 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; + } + 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.Body.Write(texture.Data, start, len); } } -- cgit v1.1