Add "debug http" command for currently simple extra debug logging of non-event queue inbound http requests to a simulator
parent
e58daf052d
commit
5c85a98f6a
|
@ -79,6 +79,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
private PollServiceRequestManager m_PollServiceManager;
|
private PollServiceRequestManager m_PollServiceManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Control the printing of certain debug messages.
|
||||||
|
/// </summary>
|
||||||
|
public int DebugLevel { get; set; }
|
||||||
|
|
||||||
public uint SSLPort
|
public uint SSLPort
|
||||||
{
|
{
|
||||||
get { return m_sslport; }
|
get { return m_sslport; }
|
||||||
|
@ -442,17 +447,20 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
string path = request.RawUrl;
|
string path = request.RawUrl;
|
||||||
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
||||||
|
|
||||||
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
|
if (DebugLevel >= 1)
|
||||||
|
m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
|
||||||
|
|
||||||
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
||||||
{
|
{
|
||||||
//m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler");
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Found stream handler {0} for request to {1}", handlerKey, path);
|
||||||
|
|
||||||
// Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
|
// Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
|
||||||
byte[] buffer = null;
|
byte[] buffer = null;
|
||||||
|
|
||||||
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
||||||
|
|
||||||
|
|
||||||
if (requestHandler is IStreamedRequestHandler)
|
if (requestHandler is IStreamedRequestHandler)
|
||||||
{
|
{
|
||||||
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
|
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
|
||||||
|
@ -556,6 +564,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
|
m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,7 +575,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if (strAccept.Contains("application/llsd+xml") ||
|
if (strAccept.Contains("application/llsd+xml") ||
|
||||||
strAccept.Contains("application/llsd+json"))
|
strAccept.Contains("application/llsd+json"))
|
||||||
{
|
{
|
||||||
//m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header");
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Found an application/llsd+xml accept header for request to {0}",
|
||||||
|
path);
|
||||||
|
|
||||||
HandleLLSDRequests(request, response);
|
HandleLLSDRequests(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -577,15 +590,24 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
case null:
|
case null:
|
||||||
case "text/html":
|
case "text/html":
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[BASE HTTP SERVER]: Found a text/html content type for request {0}", request.RawUrl);
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Found a {0} content type for request to {1}",
|
||||||
|
request.ContentType, path);
|
||||||
|
|
||||||
HandleHTTPRequest(request, response);
|
HandleHTTPRequest(request, response);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case "application/llsd+xml":
|
case "application/llsd+xml":
|
||||||
case "application/xml+llsd":
|
case "application/xml+llsd":
|
||||||
case "application/llsd+json":
|
case "application/llsd+json":
|
||||||
//m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type");
|
|
||||||
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Found a {0} content type for request to {1}",
|
||||||
|
request.ContentType, path);
|
||||||
|
|
||||||
HandleLLSDRequests(request, response);
|
HandleLLSDRequests(request, response);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -602,7 +624,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
//m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler");
|
//m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler");
|
||||||
if (DoWeHaveALLSDHandler(request.RawUrl))
|
if (DoWeHaveALLSDHandler(request.RawUrl))
|
||||||
{
|
{
|
||||||
//m_log.Info("[Debug BASE HTTP SERVER]: Found LLSD Handler");
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Found an LLSD handler for request to {0}", path);
|
||||||
|
|
||||||
HandleLLSDRequests(request, response);
|
HandleLLSDRequests(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -610,12 +635,18 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
|
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
|
||||||
if (DoWeHaveAHTTPHandler(request.RawUrl))
|
if (DoWeHaveAHTTPHandler(request.RawUrl))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Found HTTP Handler for request {0}", request.RawUrl);
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Found an HTTP handler for request to {0}", path);
|
||||||
|
|
||||||
HandleHTTPRequest(request, response);
|
HandleHTTPRequest(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Info("[Debug BASE HTTP SERVER]: Generic XMLRPC");
|
if (DebugLevel >= 2)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: Treating request to {0} as a generic XMLRPC request", path);
|
||||||
|
|
||||||
// generic login request.
|
// generic login request.
|
||||||
HandleXmlRpcRequests(request, response);
|
HandleXmlRpcRequests(request, response);
|
||||||
|
|
||||||
|
@ -978,7 +1009,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
if (llsdRequest != null)// && m_defaultLlsdHandler != null)
|
if (llsdRequest != null)// && m_defaultLlsdHandler != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
LLSDMethod llsdhandler = null;
|
LLSDMethod llsdhandler = null;
|
||||||
|
|
||||||
if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV)
|
if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV)
|
||||||
|
@ -1002,13 +1032,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
llsdResponse = GenerateNoLLSDHandlerResponse();
|
llsdResponse = GenerateNoLLSDHandlerResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llsdResponse = GenerateNoLLSDHandlerResponse();
|
llsdResponse = GenerateNoLLSDHandlerResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] buffer = new byte[0];
|
byte[] buffer = new byte[0];
|
||||||
|
|
||||||
if (llsdResponse.ToString() == "shutdown404!")
|
if (llsdResponse.ToString() == "shutdown404!")
|
||||||
{
|
{
|
||||||
response.ContentType = "text/plain";
|
response.ContentType = "text/plain";
|
||||||
|
|
|
@ -228,6 +228,14 @@ namespace OpenSim
|
||||||
+ "If an avatar name is given then only packets from that avatar are logged",
|
+ "If an avatar name is given then only packets from that avatar are logged",
|
||||||
Debug);
|
Debug);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand("region", false, "debug http",
|
||||||
|
"debug http <level>",
|
||||||
|
"Turn on inbound http request debugging for everything except the event queue (see debug eq)."
|
||||||
|
+ "If level >= 2 then the handler used to service the request is logged.\n"
|
||||||
|
+ "If level >= 1 then incoming HTTP requests are logged.\n"
|
||||||
|
+ "If level <= 0 then no extra http logging is done.\n",
|
||||||
|
Debug);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "debug scene",
|
m_console.Commands.AddCommand("region", false, "debug scene",
|
||||||
"debug scene <cripting> <collisions> <physics>",
|
"debug scene <cripting> <collisions> <physics>",
|
||||||
"Turn on scene debugging", Debug);
|
"Turn on scene debugging", Debug);
|
||||||
|
@ -860,12 +868,26 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("packet debug should be 0..255");
|
MainConsole.Instance.Output("Usage: debug packet 0..255");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "http":
|
||||||
|
if (args.Length == 3)
|
||||||
|
{
|
||||||
|
int newDebug;
|
||||||
|
if (int.TryParse(args[2], out newDebug))
|
||||||
|
{
|
||||||
|
MainServer.Instance.DebugLevel = newDebug;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output("Usage: debug http 0..2");
|
||||||
|
break;
|
||||||
|
|
||||||
case "scene":
|
case "scene":
|
||||||
if (args.Length == 5)
|
if (args.Length == 5)
|
||||||
{
|
{
|
||||||
|
@ -888,7 +910,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
|
MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue