aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs84
1 files changed, 65 insertions, 19 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index d139235..29593e5 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -648,7 +648,7 @@ namespace OpenSim.Framework.Servers.HttpServer
648 // Every month or so this will wrap and give bad numbers, not really a problem 648 // Every month or so this will wrap and give bad numbers, not really a problem
649 // since its just for reporting 649 // since its just for reporting
650 int tickdiff = requestEndTick - requestStartTick; 650 int tickdiff = requestEndTick - requestStartTick;
651 if (tickdiff > 3000) 651 if (tickdiff > 3000 && requestHandler.Name != "GetTexture")
652 { 652 {
653 m_log.InfoFormat( 653 m_log.InfoFormat(
654 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", 654 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
@@ -1532,10 +1532,38 @@ namespace OpenSim.Framework.Servers.HttpServer
1532 1532
1533 internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) 1533 internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
1534 { 1534 {
1535 //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); 1535 int responsecode;
1536 int responsecode = (int)responsedata["int_response_code"]; 1536 string responseString = String.Empty;
1537 string responseString = (string)responsedata["str_response_string"]; 1537 byte[] responseData = null;
1538 string contentType = (string)responsedata["content_type"]; 1538 string contentType;
1539
1540 if (responsedata == null)
1541 {
1542 responsecode = 500;
1543 responseString = "No response could be obtained";
1544 contentType = "text/plain";
1545 responsedata = new Hashtable();
1546 }
1547 else
1548 {
1549 try
1550 {
1551 //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
1552 responsecode = (int)responsedata["int_response_code"];
1553 if (responsedata["bin_response_data"] != null)
1554 responseData = (byte[])responsedata["bin_response_data"];
1555 else
1556 responseString = (string)responsedata["str_response_string"];
1557 contentType = (string)responsedata["content_type"];
1558 }
1559 catch
1560 {
1561 responsecode = 500;
1562 responseString = "No response could be obtained";
1563 contentType = "text/plain";
1564 responsedata = new Hashtable();
1565 }
1566 }
1539 1567
1540 if (responsedata.ContainsKey("error_status_text")) 1568 if (responsedata.ContainsKey("error_status_text"))
1541 { 1569 {
@@ -1580,25 +1608,40 @@ namespace OpenSim.Framework.Servers.HttpServer
1580 1608
1581 response.AddHeader("Content-Type", contentType); 1609 response.AddHeader("Content-Type", contentType);
1582 1610
1611 if (responsedata.ContainsKey("headers"))
1612 {
1613 Hashtable headerdata = (Hashtable)responsedata["headers"];
1614
1615 foreach (string header in headerdata.Keys)
1616 response.AddHeader(header, (string)headerdata[header]);
1617 }
1618
1583 byte[] buffer; 1619 byte[] buffer;
1584 1620
1585 if (!(contentType.Contains("image") 1621 if (responseData != null)
1586 || contentType.Contains("x-shockwave-flash")
1587 || contentType.Contains("application/x-oar")
1588 || contentType.Contains("application/vnd.ll.mesh")))
1589 { 1622 {
1590 // Text 1623 buffer = responseData;
1591 buffer = Encoding.UTF8.GetBytes(responseString);
1592 } 1624 }
1593 else 1625 else
1594 { 1626 {
1595 // Binary! 1627 if (!(contentType.Contains("image")
1596 buffer = Convert.FromBase64String(responseString); 1628 || contentType.Contains("x-shockwave-flash")
1597 } 1629 || contentType.Contains("application/x-oar")
1630 || contentType.Contains("application/vnd.ll.mesh")))
1631 {
1632 // Text
1633 buffer = Encoding.UTF8.GetBytes(responseString);
1634 }
1635 else
1636 {
1637 // Binary!
1638 buffer = Convert.FromBase64String(responseString);
1639 }
1598 1640
1599 response.SendChunked = false; 1641 response.SendChunked = false;
1600 response.ContentLength64 = buffer.Length; 1642 response.ContentLength64 = buffer.Length;
1601 response.ContentEncoding = Encoding.UTF8; 1643 response.ContentEncoding = Encoding.UTF8;
1644 }
1602 1645
1603 return buffer; 1646 return buffer;
1604 } 1647 }
@@ -1678,7 +1721,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1678 m_httpListener2.Start(64); 1721 m_httpListener2.Start(64);
1679 1722
1680 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events 1723 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
1681 m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); 1724// m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
1725 m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000);
1682 HTTPDRunning = true; 1726 HTTPDRunning = true;
1683 1727
1684 //HttpListenerContext context; 1728 //HttpListenerContext context;
@@ -1712,7 +1756,9 @@ namespace OpenSim.Framework.Servers.HttpServer
1712 1756
1713 public void httpServerException(object source, Exception exception) 1757 public void httpServerException(object source, Exception exception)
1714 { 1758 {
1715 m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); 1759 if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException"))
1760 return;
1761 m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
1716 /* 1762 /*
1717 if (HTTPDRunning)// && NotSocketErrors > 5) 1763 if (HTTPDRunning)// && NotSocketErrors > 5)
1718 { 1764 {