improve show http-handlers

master
UbitUmarov 2020-04-26 21:51:15 +01:00
parent b68748507d
commit 6050eff683
2 changed files with 27 additions and 59 deletions

View File

@ -380,6 +380,11 @@ namespace OpenSim.Framework.Servers.HttpServer
return ssh;
}
public List<string> GetIndexPHPHandlerKeys()
{
return new List<string>(m_indexPHPmethods.Keys);
}
private static string GetHandlerKey(string httpMethod, string path)
{
return httpMethod + ":" + path;
@ -603,24 +608,8 @@ namespace OpenSim.Framework.Servers.HttpServer
Culture.SetCurrentCulture();
// // 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
// // 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
// // probability event; if a request is matched it is normally expected to be
// // handled
// IHttpAgentHandler agentHandler;
//
// if (TryGetAgentHandler(request, response, out agentHandler))
// {
// if (HandleAgentRequest(agentHandler, request, response))
// {
// requestEndTick = Environment.TickCount;
// return;
// }
// }
string path = request.UriPath;
if (path != "/" && (TryGetSimpleStreamHandler(path, out ISimpleStreamHandler hdr) || TryGetSimpleStreamVarPath(path, out hdr)))
if (path != "/" && TryGetSimpleStreamHandler(path, out ISimpleStreamHandler hdr))
{
hdr.Handle(request, response);
if (request.InputStream != null && request.InputStream.CanRead)
@ -675,11 +664,6 @@ namespace OpenSim.Framework.Servers.HttpServer
headervals[headername] = request.Headers[headername];
}
// if (headervals.Contains("Host"))
// {
// host = (string)headervals["Host"];
// }
keysvals.Add("requestbody", requestBody);
keysvals.Add("headers",headervals);
if (keysvals.Contains("method"))
@ -1059,11 +1043,9 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetSimpleStreamHandler(string uripath, out ISimpleStreamHandler handler)
{
return m_simpleStreamHandlers.TryGetValue(uripath, out handler);
}
if(m_simpleStreamHandlers.TryGetValue(uripath, out handler))
return true;
private bool TryGetSimpleStreamVarPath(string uripath, out ISimpleStreamHandler handler)
{
handler = null;
if(uripath.Length < 3)
return false;
@ -1074,25 +1056,6 @@ namespace OpenSim.Framework.Servers.HttpServer
return m_simpleStreamVarPath.TryGetValue(uripath.Substring(0,indx), out handler);
}
// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
// {
// agentHandler = null;
//
// lock (m_agentHandlers)
// {
// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
// {
// if (handler.Match(request, response))
// {
// agentHandler = handler;
// return true;
// }
// }
// }
//
// return false;
// }
/// <summary>
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
/// Sends back an XMLRPC unknown request response if no handler is registered for the requested method.
@ -1115,7 +1078,6 @@ namespace OpenSim.Framework.Servers.HttpServer
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
requestBody = reader.ReadToEnd();
}
finally
{

View File

@ -241,28 +241,34 @@ namespace OpenSim.Framework.Servers
handlers.AppendFormat(
"Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port);
handlers.AppendFormat("* XMLRPC:\n");
foreach (String s in httpServer.GetXmlRpcHandlerKeys())
List<string> lst = httpServer.GetXmlRpcHandlerKeys();
handlers.AppendFormat("* XMLRPC methods ({0}):\n",lst.Count);
foreach (String s in lst)
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* HTTP:\n");
foreach (String s in httpServer.GetHTTPHandlerKeys())
lst = httpServer.GetJsonRpcHandlerKeys();
handlers.AppendFormat("* JSONRPC methods ({0}):\n", lst.Count);
foreach (String s in lst)
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* HTTP (poll):\n");
foreach (String s in httpServer.GetPollServiceHandlerKeys())
lst = httpServer.GetIndexPHPHandlerKeys();
handlers.AppendFormat("* index.php methods ({0}):\n", lst.Count);
foreach (String s in lst)
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* JSONRPC:\n");
foreach (String s in httpServer.GetJsonRpcHandlerKeys())
lst = httpServer.GetHTTPHandlerKeys();
handlers.AppendFormat("* HTTP ({0}):\n", lst.Count);
foreach (String s in lst)
handlers.AppendFormat("\t{0}\n", s);
// handlers.AppendFormat("* Agent:\n");
// foreach (String s in httpServer.GetAgentHandlerKeys())
// handlers.AppendFormat("\t{0}\n", s);
lst = httpServer.GetPollServiceHandlerKeys();
handlers.AppendFormat("* HTTP poll ({0}):\n", lst.Count);
foreach (String s in lst)
handlers.AppendFormat("\t{0}\n", s);
handlers.AppendFormat("* LLSD:\n");
foreach (String s in httpServer.GetLLSDHandlerKeys())
lst = httpServer.GetLLSDHandlerKeys();
handlers.AppendFormat("* LLSD ({0}):\n", lst.Count);
foreach (String s in lst)
handlers.AppendFormat("\t{0}\n", s);
List<string> shdrs = httpServer.GetStreamHandlerKeys();