From dd28d6ceebdcf7f1c441f4b143d106deb449d5d2 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 10 Mar 2009 18:22:46 +0000 Subject: * minor: reduce some code duplication in BaseHttpServer --- OpenSim/Framework/Servers/BaseHttpServer.cs | 41 ++++++++++++----------------- 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 617dcae..16bfbd8 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -94,17 +94,13 @@ namespace OpenSim.Framework.Servers m_port = port; } - public BaseHttpServer(uint port, bool ssl) + public BaseHttpServer(uint port, bool ssl) : this (port) { - m_ssl = ssl; - m_port = port; + m_ssl = ssl; } - public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) + public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) : this (port, ssl) { - m_ssl = ssl; - m_port = port; - if (m_ssl) { m_sslport = sslport; @@ -139,12 +135,7 @@ namespace OpenSim.Framework.Servers public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) { - lock (m_rpcHandlers) - { - m_rpcHandlers[method] = handler; - m_rpcHandlersKeepAlive[method] = true; // default - return true; - } + return AddXmlRPCHandler(method, handler, true); } public bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive) @@ -152,9 +143,10 @@ namespace OpenSim.Framework.Servers lock (m_rpcHandlers) { m_rpcHandlers[method] = handler; - m_rpcHandlersKeepAlive[method] = keepAlive; // default - return true; + m_rpcHandlersKeepAlive[method] = keepAlive; // default } + + return true; } /// @@ -1076,7 +1068,6 @@ namespace OpenSim.Framework.Servers // to display the form, or process it. // a better way would be nifty. - Stream requestStream = request.InputStream; Encoding encoding = Encoding.UTF8; @@ -1453,8 +1444,7 @@ namespace OpenSim.Framework.Servers } public void httpServerException(object source, Exception exception) - { - + { m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); /* if (HTTPDRunning)// && NotSocketErrors > 5) @@ -1495,12 +1485,16 @@ namespace OpenSim.Framework.Servers m_HTTPHandlers.Remove(path); return; } + m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); } - // Remove the agent IF it is registered. Intercept the possible - // exception. - + /// + /// Remove the agent IF it is registered. Intercept the possible exception. + /// + /// + /// + /// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) { try @@ -1517,6 +1511,7 @@ namespace OpenSim.Framework.Servers return false; } + public bool RemoveLLSDHandler(string path, LLSDMethod handler) { @@ -1536,7 +1531,6 @@ namespace OpenSim.Framework.Servers return false; } - public string GetHTTP404(string host) { string file = Path.Combine(Util.configDir(), "http_404.html"); @@ -1628,6 +1622,5 @@ namespace OpenSim.Framework.Servers return; } - } -} +} \ No newline at end of file -- cgit v1.1