if viewer asks for range reply in same format even if its full data

0.9.1.0-post-fixes
UbitUmarov 2018-11-06 15:09:49 +00:00
parent 9e274ce64d
commit 6ea394467d
3 changed files with 16 additions and 45 deletions

View File

@ -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="))

View File

@ -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

View File

@ -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