Revamp the HTTP textures handler to allow a maximum of four fetches

at any time and to drop requests for avatars n longer in the scene
This commit is contained in:
Melanie
2012-09-14 21:24:25 +02:00
parent 9f93bef111
commit 387e59ff7f
7 changed files with 294 additions and 157 deletions

View File

@@ -1449,7 +1449,8 @@ namespace OpenSim.Framework.Servers.HttpServer
internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
{
int responsecode;
string responseString;
string responseString = String.Empty;
byte[] responseData = null;
string contentType;
if (responsedata == null)
@@ -1465,7 +1466,10 @@ namespace OpenSim.Framework.Servers.HttpServer
{
//m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
responsecode = (int)responsedata["int_response_code"];
responseString = (string)responsedata["str_response_string"];
if (responsedata["bin_response_data"] != null)
responseData = (byte[])responsedata["bin_response_data"];
else
responseString = (string)responsedata["str_response_string"];
contentType = (string)responsedata["content_type"];
}
catch
@@ -1520,25 +1524,40 @@ namespace OpenSim.Framework.Servers.HttpServer
response.AddHeader("Content-Type", contentType);
if (responsedata.ContainsKey("headers"))
{
Hashtable headerdata = (Hashtable)responsedata["headers"];
foreach (string header in headerdata.Keys)
response.AddHeader(header, (string)headerdata[header]);
}
byte[] buffer;
if (!(contentType.Contains("image")
|| contentType.Contains("x-shockwave-flash")
|| contentType.Contains("application/x-oar")
|| contentType.Contains("application/vnd.ll.mesh")))
if (responseData != null)
{
// Text
buffer = Encoding.UTF8.GetBytes(responseString);
buffer = responseData;
}
else
{
// Binary!
buffer = Convert.FromBase64String(responseString);
}
if (!(contentType.Contains("image")
|| contentType.Contains("x-shockwave-flash")
|| contentType.Contains("application/x-oar")
|| contentType.Contains("application/vnd.ll.mesh")))
{
// Text
buffer = Encoding.UTF8.GetBytes(responseString);
}
else
{
// Binary!
buffer = Convert.FromBase64String(responseString);
}
response.SendChunked = false;
response.ContentLength64 = buffer.Length;
response.ContentEncoding = Encoding.UTF8;
response.SendChunked = false;
response.ContentLength64 = buffer.Length;
response.ContentEncoding = Encoding.UTF8;
}
return buffer;
}