diff options
author | Melanie | 2012-09-14 21:24:25 +0200 |
---|---|---|
committer | Melanie | 2012-09-14 21:24:25 +0200 |
commit | 387e59ff7f60f2b12526eaacd93581f76abe26e1 (patch) | |
tree | 6255bde5b8aed92e48eee4fb2e1caa03819c355f /OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |
parent | Allow setting connection limits, part 2 (diff) | |
download | opensim-SC_OLD-387e59ff7f60f2b12526eaacd93581f76abe26e1.zip opensim-SC_OLD-387e59ff7f60f2b12526eaacd93581f76abe26e1.tar.gz opensim-SC_OLD-387e59ff7f60f2b12526eaacd93581f76abe26e1.tar.bz2 opensim-SC_OLD-387e59ff7f60f2b12526eaacd93581f76abe26e1.tar.xz |
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
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 57c9d7c..6121371 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -1449,7 +1449,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1449 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1449 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1450 | { | 1450 | { |
1451 | int responsecode; | 1451 | int responsecode; |
1452 | string responseString; | 1452 | string responseString = String.Empty; |
1453 | byte[] responseData = null; | ||
1453 | string contentType; | 1454 | string contentType; |
1454 | 1455 | ||
1455 | if (responsedata == null) | 1456 | if (responsedata == null) |
@@ -1465,7 +1466,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1465 | { | 1466 | { |
1466 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1467 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); |
1467 | responsecode = (int)responsedata["int_response_code"]; | 1468 | responsecode = (int)responsedata["int_response_code"]; |
1468 | responseString = (string)responsedata["str_response_string"]; | 1469 | if (responsedata["bin_response_data"] != null) |
1470 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1471 | else | ||
1472 | responseString = (string)responsedata["str_response_string"]; | ||
1469 | contentType = (string)responsedata["content_type"]; | 1473 | contentType = (string)responsedata["content_type"]; |
1470 | } | 1474 | } |
1471 | catch | 1475 | catch |
@@ -1520,25 +1524,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1520 | 1524 | ||
1521 | response.AddHeader("Content-Type", contentType); | 1525 | response.AddHeader("Content-Type", contentType); |
1522 | 1526 | ||
1527 | if (responsedata.ContainsKey("headers")) | ||
1528 | { | ||
1529 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1530 | |||
1531 | foreach (string header in headerdata.Keys) | ||
1532 | response.AddHeader(header, (string)headerdata[header]); | ||
1533 | } | ||
1534 | |||
1523 | byte[] buffer; | 1535 | byte[] buffer; |
1524 | 1536 | ||
1525 | if (!(contentType.Contains("image") | 1537 | if (responseData != null) |
1526 | || contentType.Contains("x-shockwave-flash") | ||
1527 | || contentType.Contains("application/x-oar") | ||
1528 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1529 | { | 1538 | { |
1530 | // Text | 1539 | buffer = responseData; |
1531 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1532 | } | 1540 | } |
1533 | else | 1541 | else |
1534 | { | 1542 | { |
1535 | // Binary! | 1543 | if (!(contentType.Contains("image") |
1536 | buffer = Convert.FromBase64String(responseString); | 1544 | || contentType.Contains("x-shockwave-flash") |
1537 | } | 1545 | || contentType.Contains("application/x-oar") |
1546 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1547 | { | ||
1548 | // Text | ||
1549 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1550 | } | ||
1551 | else | ||
1552 | { | ||
1553 | // Binary! | ||
1554 | buffer = Convert.FromBase64String(responseString); | ||
1555 | } | ||
1538 | 1556 | ||
1539 | response.SendChunked = false; | 1557 | response.SendChunked = false; |
1540 | response.ContentLength64 = buffer.Length; | 1558 | response.ContentLength64 = buffer.Length; |
1541 | response.ContentEncoding = Encoding.UTF8; | 1559 | response.ContentEncoding = Encoding.UTF8; |
1560 | } | ||
1542 | 1561 | ||
1543 | return buffer; | 1562 | return buffer; |
1544 | } | 1563 | } |