diff options
author | Melanie | 2012-09-16 04:21:18 +0100 |
---|---|---|
committer | Melanie | 2012-09-16 04:21:18 +0100 |
commit | 66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba (patch) | |
tree | f5ce10e917fa3ab24ed98cc10ca5a87057da71a9 /OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Revamp the HTTP textures handler to allow a maximum of four fetches (diff) | |
download | opensim-SC-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.zip opensim-SC-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.tar.gz opensim-SC-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.tar.bz2 opensim-SC-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 44c3411..691b45a 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -632,7 +632,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
632 | // Every month or so this will wrap and give bad numbers, not really a problem | 632 | // Every month or so this will wrap and give bad numbers, not really a problem |
633 | // since its just for reporting | 633 | // since its just for reporting |
634 | int tickdiff = requestEndTick - requestStartTick; | 634 | int tickdiff = requestEndTick - requestStartTick; |
635 | if (tickdiff > 3000) | 635 | if (tickdiff > 3000 && requestHandler.Name != "GetTexture") |
636 | { | 636 | { |
637 | m_log.InfoFormat( | 637 | m_log.InfoFormat( |
638 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", | 638 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", |
@@ -1493,7 +1493,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1493 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1493 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1494 | { | 1494 | { |
1495 | int responsecode; | 1495 | int responsecode; |
1496 | string responseString; | 1496 | string responseString = String.Empty; |
1497 | byte[] responseData = null; | ||
1497 | string contentType; | 1498 | string contentType; |
1498 | 1499 | ||
1499 | if (responsedata == null) | 1500 | if (responsedata == null) |
@@ -1509,7 +1510,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1509 | { | 1510 | { |
1510 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1511 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); |
1511 | responsecode = (int)responsedata["int_response_code"]; | 1512 | responsecode = (int)responsedata["int_response_code"]; |
1512 | responseString = (string)responsedata["str_response_string"]; | 1513 | if (responsedata["bin_response_data"] != null) |
1514 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1515 | else | ||
1516 | responseString = (string)responsedata["str_response_string"]; | ||
1513 | contentType = (string)responsedata["content_type"]; | 1517 | contentType = (string)responsedata["content_type"]; |
1514 | } | 1518 | } |
1515 | catch | 1519 | catch |
@@ -1564,25 +1568,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1564 | 1568 | ||
1565 | response.AddHeader("Content-Type", contentType); | 1569 | response.AddHeader("Content-Type", contentType); |
1566 | 1570 | ||
1571 | if (responsedata.ContainsKey("headers")) | ||
1572 | { | ||
1573 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1574 | |||
1575 | foreach (string header in headerdata.Keys) | ||
1576 | response.AddHeader(header, (string)headerdata[header]); | ||
1577 | } | ||
1578 | |||
1567 | byte[] buffer; | 1579 | byte[] buffer; |
1568 | 1580 | ||
1569 | if (!(contentType.Contains("image") | 1581 | if (responseData != null) |
1570 | || contentType.Contains("x-shockwave-flash") | ||
1571 | || contentType.Contains("application/x-oar") | ||
1572 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1573 | { | 1582 | { |
1574 | // Text | 1583 | buffer = responseData; |
1575 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1576 | } | 1584 | } |
1577 | else | 1585 | else |
1578 | { | 1586 | { |
1579 | // Binary! | 1587 | if (!(contentType.Contains("image") |
1580 | buffer = Convert.FromBase64String(responseString); | 1588 | || contentType.Contains("x-shockwave-flash") |
1581 | } | 1589 | || contentType.Contains("application/x-oar") |
1590 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1591 | { | ||
1592 | // Text | ||
1593 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1594 | } | ||
1595 | else | ||
1596 | { | ||
1597 | // Binary! | ||
1598 | buffer = Convert.FromBase64String(responseString); | ||
1599 | } | ||
1582 | 1600 | ||
1583 | response.SendChunked = false; | 1601 | response.SendChunked = false; |
1584 | response.ContentLength64 = buffer.Length; | 1602 | response.ContentLength64 = buffer.Length; |
1585 | response.ContentEncoding = Encoding.UTF8; | 1603 | response.ContentEncoding = Encoding.UTF8; |
1604 | } | ||
1586 | 1605 | ||
1587 | return buffer; | 1606 | return buffer; |
1588 | } | 1607 | } |