diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 107 |
1 files changed, 88 insertions, 19 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index f252bd5..616c673 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -403,6 +403,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
403 | StreamReader reader = new StreamReader(requestStream, encoding); | 403 | StreamReader reader = new StreamReader(requestStream, encoding); |
404 | 404 | ||
405 | string requestBody = reader.ReadToEnd(); | 405 | string requestBody = reader.ReadToEnd(); |
406 | reader.Close(); | ||
406 | 407 | ||
407 | Hashtable keysvals = new Hashtable(); | 408 | Hashtable keysvals = new Hashtable(); |
408 | Hashtable headervals = new Hashtable(); | 409 | Hashtable headervals = new Hashtable(); |
@@ -460,7 +461,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
460 | } | 461 | } |
461 | 462 | ||
462 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); | 463 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); |
463 | resp.ReuseContext = true; | 464 | resp.ReuseContext = false; |
464 | HandleRequest(req, resp); | 465 | HandleRequest(req, resp); |
465 | 466 | ||
466 | // !!!HACK ALERT!!! | 467 | // !!!HACK ALERT!!! |
@@ -759,7 +760,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
759 | // Every month or so this will wrap and give bad numbers, not really a problem | 760 | // Every month or so this will wrap and give bad numbers, not really a problem |
760 | // since its just for reporting | 761 | // since its just for reporting |
761 | int tickdiff = requestEndTick - requestStartTick; | 762 | int tickdiff = requestEndTick - requestStartTick; |
762 | if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") | 763 | if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) |
763 | { | 764 | { |
764 | m_log.InfoFormat( | 765 | m_log.InfoFormat( |
765 | "[LOGHTTP] Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", | 766 | "[LOGHTTP] Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", |
@@ -1024,6 +1025,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1024 | string responseString = String.Empty; | 1025 | string responseString = String.Empty; |
1025 | XmlRpcRequest xmlRprcRequest = null; | 1026 | XmlRpcRequest xmlRprcRequest = null; |
1026 | 1027 | ||
1028 | bool gridproxy = false; | ||
1029 | if (requestBody.Contains("encoding=\"utf-8")) | ||
1030 | { | ||
1031 | int channelindx = -1; | ||
1032 | int optionsindx = requestBody.IndexOf(">options<"); | ||
1033 | if(optionsindx >0) | ||
1034 | { | ||
1035 | channelindx = requestBody.IndexOf(">channel<"); | ||
1036 | if (optionsindx < channelindx) | ||
1037 | gridproxy = true; | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1027 | try | 1041 | try |
1028 | { | 1042 | { |
1029 | xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); | 1043 | xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); |
@@ -1081,6 +1095,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1081 | } | 1095 | } |
1082 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] | 1096 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] |
1083 | 1097 | ||
1098 | if (gridproxy) | ||
1099 | xmlRprcRequest.Params.Add("gridproxy"); // Param[4] | ||
1084 | try | 1100 | try |
1085 | { | 1101 | { |
1086 | xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); | 1102 | xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); |
@@ -1732,10 +1748,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1732 | 1748 | ||
1733 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1749 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1734 | { | 1750 | { |
1735 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1751 | int responsecode; |
1736 | int responsecode = (int)responsedata["int_response_code"]; | 1752 | string responseString = String.Empty; |
1737 | string responseString = (string)responsedata["str_response_string"]; | 1753 | byte[] responseData = null; |
1738 | string contentType = (string)responsedata["content_type"]; | 1754 | string contentType; |
1755 | |||
1756 | if (responsedata == null) | ||
1757 | { | ||
1758 | responsecode = 500; | ||
1759 | responseString = "No response could be obtained"; | ||
1760 | contentType = "text/plain"; | ||
1761 | responsedata = new Hashtable(); | ||
1762 | } | ||
1763 | else | ||
1764 | { | ||
1765 | try | ||
1766 | { | ||
1767 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | ||
1768 | responsecode = (int)responsedata["int_response_code"]; | ||
1769 | if (responsedata["bin_response_data"] != null) | ||
1770 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1771 | else | ||
1772 | responseString = (string)responsedata["str_response_string"]; | ||
1773 | contentType = (string)responsedata["content_type"]; | ||
1774 | if (responseString == null) | ||
1775 | responseString = String.Empty; | ||
1776 | } | ||
1777 | catch | ||
1778 | { | ||
1779 | responsecode = 500; | ||
1780 | responseString = "No response could be obtained"; | ||
1781 | contentType = "text/plain"; | ||
1782 | responsedata = new Hashtable(); | ||
1783 | } | ||
1784 | } | ||
1739 | 1785 | ||
1740 | if (responsedata.ContainsKey("error_status_text")) | 1786 | if (responsedata.ContainsKey("error_status_text")) |
1741 | { | 1787 | { |
@@ -1780,25 +1826,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1780 | 1826 | ||
1781 | response.AddHeader("Content-Type", contentType); | 1827 | response.AddHeader("Content-Type", contentType); |
1782 | 1828 | ||
1829 | if (responsedata.ContainsKey("headers")) | ||
1830 | { | ||
1831 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1832 | |||
1833 | foreach (string header in headerdata.Keys) | ||
1834 | response.AddHeader(header, (string)headerdata[header]); | ||
1835 | } | ||
1836 | |||
1783 | byte[] buffer; | 1837 | byte[] buffer; |
1784 | 1838 | ||
1785 | if (!(contentType.Contains("image") | 1839 | if (responseData != null) |
1786 | || contentType.Contains("x-shockwave-flash") | ||
1787 | || contentType.Contains("application/x-oar") | ||
1788 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1789 | { | 1840 | { |
1790 | // Text | 1841 | buffer = responseData; |
1791 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1792 | } | 1842 | } |
1793 | else | 1843 | else |
1794 | { | 1844 | { |
1795 | // Binary! | 1845 | if (!(contentType.Contains("image") |
1796 | buffer = Convert.FromBase64String(responseString); | 1846 | || contentType.Contains("x-shockwave-flash") |
1797 | } | 1847 | || contentType.Contains("application/x-oar") |
1848 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1849 | { | ||
1850 | // Text | ||
1851 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1852 | } | ||
1853 | else | ||
1854 | { | ||
1855 | // Binary! | ||
1856 | buffer = Convert.FromBase64String(responseString); | ||
1857 | } | ||
1798 | 1858 | ||
1799 | response.SendChunked = false; | 1859 | response.SendChunked = false; |
1800 | response.ContentLength64 = buffer.Length; | 1860 | response.ContentLength64 = buffer.Length; |
1801 | response.ContentEncoding = Encoding.UTF8; | 1861 | response.ContentEncoding = Encoding.UTF8; |
1862 | } | ||
1802 | 1863 | ||
1803 | return buffer; | 1864 | return buffer; |
1804 | } | 1865 | } |
@@ -1886,9 +1947,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1886 | m_httpListener2.Start(64); | 1947 | m_httpListener2.Start(64); |
1887 | 1948 | ||
1888 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 1949 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
1950 | <<<<<<< HEAD | ||
1889 | PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000); | 1951 | PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000); |
1890 | PollServiceRequestManager.Start(); | 1952 | PollServiceRequestManager.Start(); |
1891 | 1953 | ||
1954 | ======= | ||
1955 | m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); | ||
1956 | m_PollServiceManager.Start(); | ||
1957 | >>>>>>> avn/ubitvar | ||
1892 | HTTPDRunning = true; | 1958 | HTTPDRunning = true; |
1893 | 1959 | ||
1894 | //HttpListenerContext context; | 1960 | //HttpListenerContext context; |
@@ -1937,7 +2003,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1937 | 2003 | ||
1938 | public void httpServerException(object source, Exception exception) | 2004 | public void httpServerException(object source, Exception exception) |
1939 | { | 2005 | { |
1940 | m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); | 2006 | if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException")) |
2007 | return; | ||
2008 | m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); | ||
1941 | /* | 2009 | /* |
1942 | if (HTTPDRunning)// && NotSocketErrors > 5) | 2010 | if (HTTPDRunning)// && NotSocketErrors > 5) |
1943 | { | 2011 | { |
@@ -1984,6 +2052,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1984 | 2052 | ||
1985 | public void RemoveHTTPHandler(string httpMethod, string path) | 2053 | public void RemoveHTTPHandler(string httpMethod, string path) |
1986 | { | 2054 | { |
2055 | if (path == null) return; // Caps module isn't loaded, tries to remove handler where path = null | ||
1987 | lock (m_HTTPHandlers) | 2056 | lock (m_HTTPHandlers) |
1988 | { | 2057 | { |
1989 | if (httpMethod != null && httpMethod.Length == 0) | 2058 | if (httpMethod != null && httpMethod.Length == 0) |