* minor: reduce some code duplication in BaseHttpServer
parent
327720498e
commit
dd28d6ceeb
|
@ -94,17 +94,13 @@ namespace OpenSim.Framework.Servers
|
||||||
m_port = port;
|
m_port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseHttpServer(uint port, bool ssl)
|
public BaseHttpServer(uint port, bool ssl) : this (port)
|
||||||
{
|
{
|
||||||
m_ssl = ssl;
|
m_ssl = ssl;
|
||||||
m_port = port;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (m_ssl)
|
||||||
{
|
{
|
||||||
m_sslport = sslport;
|
m_sslport = sslport;
|
||||||
|
@ -139,12 +135,7 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
|
public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
|
||||||
{
|
{
|
||||||
lock (m_rpcHandlers)
|
return AddXmlRPCHandler(method, handler, true);
|
||||||
{
|
|
||||||
m_rpcHandlers[method] = handler;
|
|
||||||
m_rpcHandlersKeepAlive[method] = true; // default
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive)
|
public bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive)
|
||||||
|
@ -152,9 +143,10 @@ namespace OpenSim.Framework.Servers
|
||||||
lock (m_rpcHandlers)
|
lock (m_rpcHandlers)
|
||||||
{
|
{
|
||||||
m_rpcHandlers[method] = handler;
|
m_rpcHandlers[method] = handler;
|
||||||
m_rpcHandlersKeepAlive[method] = keepAlive; // default
|
m_rpcHandlersKeepAlive[method] = keepAlive; // default
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1076,7 +1068,6 @@ namespace OpenSim.Framework.Servers
|
||||||
// to display the form, or process it.
|
// to display the form, or process it.
|
||||||
// a better way would be nifty.
|
// a better way would be nifty.
|
||||||
|
|
||||||
|
|
||||||
Stream requestStream = request.InputStream;
|
Stream requestStream = request.InputStream;
|
||||||
|
|
||||||
Encoding encoding = Encoding.UTF8;
|
Encoding encoding = Encoding.UTF8;
|
||||||
|
@ -1453,8 +1444,7 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
|
|
||||||
public void httpServerException(object source, Exception exception)
|
public void httpServerException(object source, Exception exception)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
|
m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
|
||||||
/*
|
/*
|
||||||
if (HTTPDRunning)// && NotSocketErrors > 5)
|
if (HTTPDRunning)// && NotSocketErrors > 5)
|
||||||
|
@ -1495,12 +1485,16 @@ namespace OpenSim.Framework.Servers
|
||||||
m_HTTPHandlers.Remove(path);
|
m_HTTPHandlers.Remove(path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
|
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the agent IF it is registered. Intercept the possible
|
/// <summary>
|
||||||
// exception.
|
/// Remove the agent IF it is registered. Intercept the possible exception.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agent"></param>
|
||||||
|
/// <param name="handler"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1517,6 +1511,7 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
|
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1536,7 +1531,6 @@ namespace OpenSim.Framework.Servers
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string GetHTTP404(string host)
|
public string GetHTTP404(string host)
|
||||||
{
|
{
|
||||||
string file = Path.Combine(Util.configDir(), "http_404.html");
|
string file = Path.Combine(Util.configDir(), "http_404.html");
|
||||||
|
@ -1628,6 +1622,5 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue