Merge branch 'master' into bigmerge

avinationmerge
Melanie 2011-12-01 12:16:59 +00:00
commit b60ff651a3
8 changed files with 116 additions and 55 deletions

View File

@ -147,9 +147,8 @@ namespace OpenSim.Framework.Capabilities
/// Return an LLSD-serializable Hashtable describing the /// Return an LLSD-serializable Hashtable describing the
/// capabilities and their handler details. /// capabilities and their handler details.
/// </summary> /// </summary>
public Hashtable CapsDetails /// <param name="excludeSeed">If true, then exclude the seed cap.</param>
{ public Hashtable GetCapsDetails(bool excludeSeed)
get
{ {
Hashtable caps = new Hashtable(); Hashtable caps = new Hashtable();
string protocol = "http://"; string protocol = "http://";
@ -160,12 +159,13 @@ namespace OpenSim.Framework.Capabilities
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
foreach (string capsName in m_capsHandlers.Keys) foreach (string capsName in m_capsHandlers.Keys)
{ {
// skip SEED cap if (excludeSeed && "SEED" == capsName)
if ("SEED" == capsName) continue; continue;
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path; caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
} }
return caps; return caps;
} }
} }
} }
}

View File

@ -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,18 @@ 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 (TryGetStreamHandler(handlerKey, out requestHandler)) if (TryGetStreamHandler(handlerKey, out requestHandler))
{ {
//m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); if (DebugLevel >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Found stream handler for {0} {1}",
request.HttpMethod, request.Url.PathAndQuery);
// 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;
@ -480,7 +486,6 @@ namespace OpenSim.Framework.Servers.HttpServer
string[] querystringkeys = request.QueryString.AllKeys; string[] querystringkeys = request.QueryString.AllKeys;
string[] rHeaders = request.Headers.AllKeys; string[] rHeaders = request.Headers.AllKeys;
foreach (string queryname in querystringkeys) foreach (string queryname in querystringkeys)
{ {
keysvals.Add(queryname, request.QueryString[queryname]); keysvals.Add(queryname, request.QueryString[queryname]);
@ -556,6 +561,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 +572,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 >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Found application/llsd+xml accept header handler for {0} {1}",
request.HttpMethod, request.Url.PathAndQuery);
HandleLLSDRequests(request, response); HandleLLSDRequests(request, response);
return; return;
} }
@ -577,15 +587,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 >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
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 >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
HandleLLSDRequests(request, response); HandleLLSDRequests(request, response);
return; return;
@ -602,7 +621,11 @@ 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 >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
HandleLLSDRequests(request, response); HandleLLSDRequests(request, response);
return; return;
} }
@ -610,12 +633,20 @@ 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 >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
HandleHTTPRequest(request, response); HandleHTTPRequest(request, response);
return; return;
} }
//m_log.Info("[Debug BASE HTTP SERVER]: Generic XMLRPC"); if (DebugLevel >= 1)
m_log.DebugFormat(
"[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
request.HttpMethod, request.Url.PathAndQuery);
// generic login request. // generic login request.
HandleXmlRpcRequests(request, response); HandleXmlRpcRequests(request, response);
@ -872,7 +903,9 @@ namespace OpenSim.Framework.Servers.HttpServer
byte[] buf = Encoding.UTF8.GetBytes("Not found"); byte[] buf = Encoding.UTF8.GetBytes("Not found");
response.KeepAlive = false; response.KeepAlive = false;
m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); m_log.ErrorFormat(
"[BASE HTTP SERVER]: Handler not found for http request {0} {1}",
request.HttpMethod, request.Url.PathAndQuery);
response.SendChunked = false; response.SendChunked = false;
response.ContentLength64 = buf.Length; response.ContentLength64 = buf.Length;
@ -978,7 +1011,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 +1034,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";

View File

@ -242,6 +242,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);
@ -337,7 +345,7 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "backup", m_console.Commands.AddCommand("region", false, "backup",
"backup", "backup",
"Persist objects to the database now", RunCommand); "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand);
m_console.Commands.AddCommand("region", false, "create region", m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] <region_file.ini>", "create region [\"region name\"] <region_file.ini>",
@ -886,15 +894,32 @@ namespace OpenSim
if (int.TryParse(args[2], out newDebug)) if (int.TryParse(args[2], out newDebug))
{ {
m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name);
// We provide user information elsewhere if any clients had their debug level set.
// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug);
} }
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;
MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
break;
}
}
MainConsole.Instance.Output("Usage: debug http 0..2");
break;
case "scene": case "scene":
if (args.Length == 5) if (args.Length == 5)
{ {
@ -917,13 +942,13 @@ 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;
default: default:
MainConsole.Instance.Output("Unknown debug"); MainConsole.Instance.Output("Unknown debug command");
break; break;
} }
} }

View File

@ -238,7 +238,8 @@ namespace OpenSim.Region.ClientStack.Linden
return string.Empty; return string.Empty;
} }
Hashtable caps = m_HostCapsObj.CapsHandlers.CapsDetails; Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true);
// Add the external too // Add the external too
foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers) foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers)
caps[kvp.Key] = kvp.Value; caps[kvp.Key] = kvp.Value;

View File

@ -110,8 +110,9 @@ namespace OpenSim.Region.ClientStack.Linden
false, false,
"debug eq", "debug eq",
"debug eq [0|1]", "debug eq [0|1]",
"Turn on event queue debugging",
"debug eq 1 will turn on event queue debugging. This will log all outgoing event queue messages to clients.\n" "debug eq 1 will turn on event queue debugging. This will log all outgoing event queue messages to clients.\n"
+ "debug eq 1 will turn off event queue debugging.", + "debug eq 0 will turn off event queue debugging.",
HandleDebugEq); HandleDebugEq);
} }
else else

View File

@ -29,6 +29,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using Mono.Addins; using Mono.Addins;
@ -47,6 +48,8 @@ namespace OpenSim.Region.CoreModules.Framework
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_showCapsCommandFormat = " {0,-38} {1,-60}\n";
protected Scene m_scene; protected Scene m_scene;
/// <summary> /// <summary>
@ -68,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Framework
m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps",
"show caps", "show caps",
"Shows all registered capabilities", CapabilitiesCommand); "Shows all registered capabilities", HandleShowCapsCommand);
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -228,21 +231,23 @@ namespace OpenSim.Region.CoreModules.Framework
} }
} }
private void CapabilitiesCommand(string module, string[] cmdparams) private void HandleShowCapsCommand(string module, string[] cmdparams)
{ {
System.Text.StringBuilder caps = new System.Text.StringBuilder(); StringBuilder caps = new StringBuilder();
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects) foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
{ {
caps.AppendFormat("** User {0}:\n", kvp.Key); caps.AppendFormat("** User {0}:\n", kvp.Key);
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); )
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false).GetEnumerator(); kvp2.MoveNext(); )
{ {
Uri uri = new Uri(kvp2.Value.ToString()); Uri uri = new Uri(kvp2.Value.ToString());
caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
} }
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers) foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
caps.AppendFormat(" {0} = {1}\n", kvp3.Key, kvp3.Value); caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
} }
MainConsole.Instance.Output(caps.ToString()); MainConsole.Instance.Output(caps.ToString());

View File

@ -218,10 +218,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.AddCommand(this, "debug permissions", m_scene.AddCommand(this, "debug permissions",
"debug permissions <true / false>", "debug permissions <true / false>",
"Enable permissions debugging", "Turn on permissions debugging",
HandleDebugPermissions); HandleDebugPermissions);
string grant = myConfig.GetString("GrantLSL",""); string grant = myConfig.GetString("GrantLSL","");
if (grant.Length > 0) { if (grant.Length > 0) {
foreach (string uuidl in grant.Split(',')) { foreach (string uuidl in grant.Split(',')) {

View File

@ -170,8 +170,6 @@ namespace OpenSim.Region.Physics.Meshing
float maxZ = float.MinValue; float maxZ = float.MinValue;
foreach (Vector3 v in meshIn.getVertexList()) foreach (Vector3 v in meshIn.getVertexList())
{
if (v != null)
{ {
if (v.X < minX) minX = v.X; if (v.X < minX) minX = v.X;
if (v.Y < minY) minY = v.Y; if (v.Y < minY) minY = v.Y;
@ -181,7 +179,6 @@ namespace OpenSim.Region.Physics.Meshing
if (v.Y > maxY) maxY = v.Y; if (v.Y > maxY) maxY = v.Y;
if (v.Z > maxZ) maxZ = v.Z; if (v.Z > maxZ) maxZ = v.Z;
} }
}
return CreateSimpleBoxMesh(minX, maxX, minY, maxY, minZ, maxZ); return CreateSimpleBoxMesh(minX, maxX, minY, maxY, minZ, maxZ);
} }