Comment out the long unused afaik HTTP agent handlers.
As far as I know, this was only used by the IBM Rest modules, much of which has been commented out for a very long time now. Other similar code uses HTTP or stream handlers instead. So commenting this out to reduce code complexity and the need to make this facility consistent with the others where it may not be used anyway. If this facility is actually being used then please notify me or uncomment it if you are core.0.7.4-extended
parent
6739f0752b
commit
44699b07e4
|
@ -312,14 +312,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
// Now that everything is setup we can proceed to
|
// Now that everything is setup we can proceed to
|
||||||
// add THIS agent to the HTTP server's handler list
|
// add THIS agent to the HTTP server's handler list
|
||||||
|
|
||||||
if (!AddAgentHandler(Rest.Name,this))
|
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||||
{
|
// have to be handled through the AddHttpHandler interface.
|
||||||
Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
// if (!AddAgentHandler(Rest.Name,this))
|
||||||
foreach (IRest handler in handlers)
|
// {
|
||||||
{
|
// Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
||||||
handler.Close();
|
// foreach (IRest handler in handlers)
|
||||||
}
|
// {
|
||||||
}
|
// handler.Close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -342,11 +344,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
||||||
|
|
||||||
try
|
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||||
{
|
// have to be handled through the AddHttpHandler interface.
|
||||||
RemoveAgentHandler(Rest.Name, this);
|
// try
|
||||||
}
|
// {
|
||||||
catch (KeyNotFoundException){}
|
// RemoveAgentHandler(Rest.Name, this);
|
||||||
|
// }
|
||||||
|
// catch (KeyNotFoundException){}
|
||||||
|
|
||||||
foreach (IRest handler in handlers)
|
foreach (IRest handler in handlers)
|
||||||
{
|
{
|
||||||
|
|
|
@ -297,7 +297,9 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
{
|
{
|
||||||
if (!IsEnabled) return false;
|
if (!IsEnabled) return false;
|
||||||
_agents.Add(agentName, handler);
|
_agents.Add(agentName, handler);
|
||||||
return _httpd.AddAgentHandler(agentName, handler);
|
// return _httpd.AddAgentHandler(agentName, handler);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -316,7 +318,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
if (_agents[agentName] == handler)
|
if (_agents[agentName] == handler)
|
||||||
{
|
{
|
||||||
_agents.Remove(agentName);
|
_agents.Remove(agentName);
|
||||||
return _httpd.RemoveAgentHandler(agentName, handler);
|
// return _httpd.RemoveAgentHandler(agentName, handler);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -358,10 +360,10 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
||||||
}
|
}
|
||||||
_handlers = null;
|
_handlers = null;
|
||||||
foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
// foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
||||||
{
|
// {
|
||||||
_httpd.RemoveAgentHandler(h.Key, h.Value);
|
// _httpd.RemoveAgentHandler(h.Key, h.Value);
|
||||||
}
|
// }
|
||||||
_agents = null;
|
_agents = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
||||||
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
||||||
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
||||||
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||||
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
||||||
new Dictionary<string, PollServiceEventArgs>();
|
new Dictionary<string, PollServiceEventArgs>();
|
||||||
|
|
||||||
|
@ -260,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return new List<string>(m_pollHandlers.Keys);
|
return new List<string>(m_pollHandlers.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// // Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// // the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// // value.
|
||||||
public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
// public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
if (!m_agentHandlers.ContainsKey(agent))
|
// if (!m_agentHandlers.ContainsKey(agent))
|
||||||
{
|
// {
|
||||||
m_agentHandlers.Add(agent, handler);
|
// m_agentHandlers.Add(agent, handler);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//must already have a handler for that path so return false
|
// //must already have a handler for that path so return false
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<string> GetAgentHandlerKeys()
|
// public List<string> GetAgentHandlerKeys()
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
return new List<string>(m_agentHandlers.Keys);
|
// return new List<string>(m_agentHandlers.Keys);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
||||||
{
|
{
|
||||||
|
@ -438,22 +438,22 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||||
|
|
||||||
// This is the REST agent interface. We require an agent to properly identify
|
// // This is the REST agent interface. We require an agent to properly identify
|
||||||
// itself. If the REST handler recognizes the prefix it will attempt to
|
// // itself. If the REST handler recognizes the prefix it will attempt to
|
||||||
// satisfy the request. If it is not recognizable, and no damage has occurred
|
// // satisfy the request. If it is not recognizable, and no damage has occurred
|
||||||
// the request can be passed through to the other handlers. This is a low
|
// // the request can be passed through to the other handlers. This is a low
|
||||||
// probability event; if a request is matched it is normally expected to be
|
// // probability event; if a request is matched it is normally expected to be
|
||||||
// handled
|
// // handled
|
||||||
IHttpAgentHandler agentHandler;
|
// IHttpAgentHandler agentHandler;
|
||||||
|
//
|
||||||
if (TryGetAgentHandler(request, response, out agentHandler))
|
// if (TryGetAgentHandler(request, response, out agentHandler))
|
||||||
{
|
// {
|
||||||
if (HandleAgentRequest(agentHandler, request, response))
|
// if (HandleAgentRequest(agentHandler, request, response))
|
||||||
{
|
// {
|
||||||
requestEndTick = Environment.TickCount;
|
// requestEndTick = Environment.TickCount;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//response.KeepAlive = true;
|
//response.KeepAlive = true;
|
||||||
response.SendChunked = false;
|
response.SendChunked = false;
|
||||||
|
@ -830,24 +830,24 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||||
{
|
// {
|
||||||
agentHandler = null;
|
// agentHandler = null;
|
||||||
|
//
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||||
{
|
// {
|
||||||
if (handler.Match(request, response))
|
// if (handler.Match(request, response))
|
||||||
{
|
// {
|
||||||
agentHandler = handler;
|
// agentHandler = handler;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
||||||
|
@ -1772,21 +1772,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
m_pollHandlers.Remove(path);
|
m_pollHandlers.Remove(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
IHttpAgentHandler foundHandler;
|
// IHttpAgentHandler foundHandler;
|
||||||
|
//
|
||||||
if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
||||||
{
|
// {
|
||||||
m_agentHandlers.Remove(agent);
|
// m_agentHandlers.Remove(agent);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void RemoveXmlRPCHandler(string method)
|
public void RemoveXmlRPCHandler(string method)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
uint Port { get; }
|
uint Port { get; }
|
||||||
bool UseSSL { get; }
|
bool UseSSL { get; }
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// // Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// // the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// // value.
|
||||||
bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
// bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a handler for an HTTP request.
|
/// Add a handler for an HTTP request.
|
||||||
|
@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Remove the agent if it is registered.
|
// /// Remove the agent if it is registered.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="agent"></param>
|
// /// <param name="agent"></param>
|
||||||
/// <param name="handler"></param>
|
// /// <param name="handler"></param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an HTTP handler
|
/// Remove an HTTP handler
|
||||||
|
|
|
@ -231,9 +231,9 @@ namespace OpenSim.Framework.Servers
|
||||||
foreach (String s in httpServer.GetHTTPHandlerKeys())
|
foreach (String s in httpServer.GetHTTPHandlerKeys())
|
||||||
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
||||||
|
|
||||||
handlers.AppendFormat("* Agent:\n");
|
// handlers.AppendFormat("* Agent:\n");
|
||||||
foreach (String s in httpServer.GetAgentHandlerKeys())
|
// foreach (String s in httpServer.GetAgentHandlerKeys())
|
||||||
handlers.AppendFormat("\t{0}\n", s);
|
// handlers.AppendFormat("\t{0}\n", s);
|
||||||
|
|
||||||
handlers.AppendFormat("* LLSD:\n");
|
handlers.AppendFormat("* LLSD:\n");
|
||||||
foreach (String s in httpServer.GetLLSDHandlerKeys())
|
foreach (String s in httpServer.GetLLSDHandlerKeys())
|
||||||
|
|
Loading…
Reference in New Issue