From 25111e703f54d84c7c51e32db1f94332ea3ffd00 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 11 Sep 2012 21:48:02 +0100
Subject: Add levels 4 and 5 to "debug http" console command that will log a
sample of incoming request data and the entire incoming data respectively.
See "help debug http" for more details.
---
.../Framework/Servers/HttpServer/BaseHttpServer.cs | 68 ++++++++++++++++++----
OpenSim/Framework/Servers/MainServer.cs | 2 +
OpenSim/Framework/Util.cs | 32 ++++++++++
3 files changed, 90 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index f57ea76..c81e283 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -449,9 +449,7 @@ namespace OpenSim.Framework.Servers.HttpServer
if (TryGetStreamHandler(handlerKey, out requestHandler))
{
if (DebugLevel >= 3)
- m_log.DebugFormat(
- "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
- request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
+ LogIncomingToStreamHandler(request, requestHandler);
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
@@ -563,9 +561,7 @@ namespace OpenSim.Framework.Servers.HttpServer
if (DoWeHaveALLSDHandler(request.RawUrl))
{
if (DebugLevel >= 3)
- m_log.DebugFormat(
- "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
- request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
+ LogIncomingToContentTypeHandler(request);
buffer = HandleLLSDRequests(request, response);
}
@@ -573,18 +569,14 @@ namespace OpenSim.Framework.Servers.HttpServer
else if (DoWeHaveAHTTPHandler(request.RawUrl))
{
if (DebugLevel >= 3)
- m_log.DebugFormat(
- "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
- request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
+ LogIncomingToContentTypeHandler(request);
buffer = HandleHTTPRequest(request, response);
}
else
{
if (DebugLevel >= 3)
- m_log.DebugFormat(
- "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
- request.HttpMethod, request.Url.PathAndQuery);
+ LogIncomingToXmlRpcHandler(request);
// generic login request.
buffer = HandleXmlRpcRequests(request, response);
@@ -654,6 +646,58 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
+ private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
+ {
+ m_log.DebugFormat(
+ "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
+ request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
+
+ if (DebugLevel >= 4)
+ LogIncomingInDetail(request);
+ }
+
+ private void LogIncomingToContentTypeHandler(OSHttpRequest request)
+ {
+ m_log.DebugFormat(
+ "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
+ request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
+
+ if (DebugLevel >= 4)
+ LogIncomingInDetail(request);
+ }
+
+ private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
+ {
+ m_log.DebugFormat(
+ "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
+ request.HttpMethod, request.Url.PathAndQuery);
+
+ if (DebugLevel >= 4)
+ LogIncomingInDetail(request);
+ }
+
+ private void LogIncomingInDetail(OSHttpRequest request)
+ {
+ using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8))
+ {
+ string output;
+
+ if (DebugLevel == 4)
+ {
+ const int sampleLength = 80;
+ char[] sampleChars = new char[sampleLength];
+ reader.Read(sampleChars, 0, sampleLength);
+ output = string.Format("[BASE HTTP SERVER]: {0}...", sampleChars);
+ }
+ else
+ {
+ output = string.Format("[BASE HTTP SERVER]: {0}", reader.ReadToEnd());
+ }
+
+ m_log.Debug(output);
+ }
+ }
+
private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler)
{
string bestMatch = null;
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index 8dc0e3a..1ac0953 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -111,6 +111,8 @@ namespace OpenSim.Framework.Servers
+ "If level >= 1, then short warnings are logged when receiving bad input data.\n"
+ "If level >= 2, then long warnings are logged when receiving bad input data.\n"
+ "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n"
+ + "If level >= 4, then a sample from the beginning of the incoming data is logged.\n"
+ + "If level >= 5, then the entire incoming data is logged.\n"
+ "If no level is specified then the current level is returned.",
HandleDebugHttpCommand);
}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 38cb3a6..1b9777f 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1007,6 +1007,38 @@ namespace OpenSim.Framework
}
}
+ ///
+ /// Copy data from one stream to another, leaving the read position of both streams at the beginning.
+ ///
+ ///
+ /// Input stream. Must be seekable.
+ ///
+ ///
+ /// Thrown if the input stream is not seekable.
+ ///
+ public static Stream Copy(Stream inputStream)
+ {
+ if (!inputStream.CanSeek)
+ throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek");
+
+ const int readSize = 256;
+ byte[] buffer = new byte[readSize];
+ MemoryStream ms = new MemoryStream();
+
+ int count = inputStream.Read(buffer, 0, readSize);
+
+ while (count > 0)
+ {
+ ms.Write(buffer, 0, count);
+ count = inputStream.Read(buffer, 0, readSize);
+ }
+
+ ms.Position = 0;
+ inputStream.Position = 0;
+
+ return ms;
+ }
+
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
{
return SendXmlRpcCommand(url, methodName, args);
--
cgit v1.1
From d53a53d4c599e77f039149128526ac67570b30fb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 12 Sep 2012 00:10:48 +0100
Subject: Make "show http-handlers" command available for ROBUST instances as
well as the simulator executable.
---
OpenSim/Framework/Servers/MainServer.cs | 51 +++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index 1ac0953..b367b12 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using System.Net;
+using System.Text;
using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Console;
@@ -105,6 +106,11 @@ namespace OpenSim.Framework.Servers
public static void RegisterHttpConsoleCommands(ICommandConsole console)
{
console.Commands.AddCommand(
+ "Comms", false, "show http-handlers",
+ "show http-handlers",
+ "Show all registered http handlers", HandleShowHttpHandlersCommand);
+
+ console.Commands.AddCommand(
"Debug", false, "debug http", "debug http []",
"Turn on inbound non-poll http request debugging.",
"If level <= 0, then no extra logging is done.\n"
@@ -142,6 +148,51 @@ namespace OpenSim.Framework.Servers
}
}
+ private static void HandleShowHttpHandlersCommand(string module, string[] args)
+ {
+ if (args.Length != 2)
+ {
+ MainConsole.Instance.Output("Usage: show http-handlers");
+ return;
+ }
+
+ StringBuilder handlers = new StringBuilder();
+
+ lock (m_Servers)
+ {
+ foreach (BaseHttpServer httpServer in m_Servers.Values)
+ {
+ 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())
+ handlers.AppendFormat("\t{0}\n", s);
+
+ handlers.AppendFormat("* HTTP:\n");
+ List poll = httpServer.GetPollServiceHandlerKeys();
+ foreach (String s in httpServer.GetHTTPHandlerKeys())
+ handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
+
+ handlers.AppendFormat("* Agent:\n");
+ foreach (String s in httpServer.GetAgentHandlerKeys())
+ handlers.AppendFormat("\t{0}\n", s);
+
+ handlers.AppendFormat("* LLSD:\n");
+ foreach (String s in httpServer.GetLLSDHandlerKeys())
+ handlers.AppendFormat("\t{0}\n", s);
+
+ handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count);
+ foreach (String s in httpServer.GetStreamHandlerKeys())
+ handlers.AppendFormat("\t{0}\n", s);
+
+ handlers.Append("\n");
+ }
+ }
+
+ MainConsole.Instance.Output(handlers.ToString());
+ }
+
///
/// Register an already started HTTP server to the collection of known servers.
///
--
cgit v1.1
From c17965eec41e0c37f43cc3d4a7c12e52280db59d Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 8 Sep 2012 12:53:30 +0100
Subject: mathematically & hypothetically speaking we want to avoid negative
values being written
---
OpenSim/Framework/RegionInfo.cs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index ded2df2..928e798 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -701,27 +701,27 @@ namespace OpenSim.Framework
config.Set("ExternalHostName", m_externalHostName);
- if (m_nonphysPrimMin != 0)
+ if (m_nonphysPrimMin > 0)
config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
- if (m_nonphysPrimMax != 0)
+ if (m_nonphysPrimMax > 0)
config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
- if (m_physPrimMin != 0)
+ if (m_physPrimMin > 0)
config.Set("PhysicalPrimMax", m_physPrimMin);
- if (m_physPrimMax != 0)
+ if (m_physPrimMax > 0)
config.Set("PhysicalPrimMax", m_physPrimMax);
config.Set("ClampPrimSize", m_clampPrimSize.ToString());
- if (m_objectCapacity != 0)
+ if (m_objectCapacity > 0)
config.Set("MaxPrims", m_objectCapacity);
- if (m_linksetCapacity != 0)
+ if (m_linksetCapacity > 0)
config.Set("LinksetPrims", m_linksetCapacity);
- if (m_agentCapacity != 0)
+ if (m_agentCapacity > 0)
config.Set("MaxAgents", m_agentCapacity);
if (ScopeID != UUID.Zero)
--
cgit v1.1
From 7df7b86ec5e6186fc86dd075792f56001cac66f2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 12 Sep 2012 23:01:07 +0100
Subject: Fix bug in logging sample input at debug http level 4.
Also converts newlines to "\n" text.
---
OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index c81e283..43a19fa 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -687,7 +687,7 @@ namespace OpenSim.Framework.Servers.HttpServer
const int sampleLength = 80;
char[] sampleChars = new char[sampleLength];
reader.Read(sampleChars, 0, sampleLength);
- output = string.Format("[BASE HTTP SERVER]: {0}...", sampleChars);
+ output = string.Format("[BASE HTTP SERVER]: {0}...", new string(sampleChars).Replace("\n", @"\n"));
}
else
{
--
cgit v1.1
From cdc3781f42869586aa4bba482359f8cda21cb912 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 12 Sep 2012 23:02:25 +0100
Subject: Fix usage statement on "debug http" console command since max level
is now 5 rather than 3
---
OpenSim/Framework/Servers/MainServer.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index b367b12..7402c73 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Framework.Servers
}
else
{
- MainConsole.Instance.Output("Usage: debug http 0..3");
+ MainConsole.Instance.Output("Usage: debug http 0..5");
}
}
--
cgit v1.1
From ce468215d576cc301a261d85bee9baa68a246ce6 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Tue, 24 Jul 2012 19:48:08 +0300
Subject: Support multi-region OAR files
Merged ArchiveWriteRequestPreparation.cs and ArchiveWriteRequestExecution.cs. This simplifies the code, and it's faster to write each scene to the archive as it's found rather than all at once at the end.
---
OpenSim/Framework/Serialization/ArchiveConstants.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 2c5e001..48f1c4f 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -53,6 +53,11 @@ namespace OpenSim.Framework.Serialization
public const string INVENTORY_PATH = "inventory/";
///
+ /// Path for regions in a multi-region archive
+ ///
+ public const string REGIONS_PATH = "regions/";
+
+ ///
/// Path for the prims file
///
public const string OBJECTS_PATH = "objects/";
--
cgit v1.1