diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 14 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/ArchiveConstants.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 68 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/MainServer.cs | 55 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 32 |
5 files changed, 154 insertions, 20 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index da87b05..fc64ff9 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -706,27 +706,27 @@ namespace OpenSim.Framework | |||
706 | 706 | ||
707 | config.Set("ExternalHostName", m_externalHostName); | 707 | config.Set("ExternalHostName", m_externalHostName); |
708 | 708 | ||
709 | if (m_nonphysPrimMin != 0) | 709 | if (m_nonphysPrimMin > 0) |
710 | config.Set("NonphysicalPrimMax", m_nonphysPrimMin); | 710 | config.Set("NonphysicalPrimMax", m_nonphysPrimMin); |
711 | 711 | ||
712 | if (m_nonphysPrimMax != 0) | 712 | if (m_nonphysPrimMax > 0) |
713 | config.Set("NonphysicalPrimMax", m_nonphysPrimMax); | 713 | config.Set("NonphysicalPrimMax", m_nonphysPrimMax); |
714 | 714 | ||
715 | if (m_physPrimMin != 0) | 715 | if (m_physPrimMin > 0) |
716 | config.Set("PhysicalPrimMax", m_physPrimMin); | 716 | config.Set("PhysicalPrimMax", m_physPrimMin); |
717 | 717 | ||
718 | if (m_physPrimMax != 0) | 718 | if (m_physPrimMax > 0) |
719 | config.Set("PhysicalPrimMax", m_physPrimMax); | 719 | config.Set("PhysicalPrimMax", m_physPrimMax); |
720 | 720 | ||
721 | config.Set("ClampPrimSize", m_clampPrimSize.ToString()); | 721 | config.Set("ClampPrimSize", m_clampPrimSize.ToString()); |
722 | 722 | ||
723 | if (m_objectCapacity != 0) | 723 | if (m_objectCapacity > 0) |
724 | config.Set("MaxPrims", m_objectCapacity); | 724 | config.Set("MaxPrims", m_objectCapacity); |
725 | 725 | ||
726 | if (m_linksetCapacity != 0) | 726 | if (m_linksetCapacity > 0) |
727 | config.Set("LinksetPrims", m_linksetCapacity); | 727 | config.Set("LinksetPrims", m_linksetCapacity); |
728 | 728 | ||
729 | if (m_agentCapacity != 0) | 729 | if (m_agentCapacity > 0) |
730 | config.Set("MaxAgents", m_agentCapacity); | 730 | config.Set("MaxAgents", m_agentCapacity); |
731 | 731 | ||
732 | if (ScopeID != UUID.Zero) | 732 | if (ScopeID != UUID.Zero) |
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 | |||
53 | public const string INVENTORY_PATH = "inventory/"; | 53 | public const string INVENTORY_PATH = "inventory/"; |
54 | 54 | ||
55 | /// <value> | 55 | /// <value> |
56 | /// Path for regions in a multi-region archive | ||
57 | /// </value> | ||
58 | public const string REGIONS_PATH = "regions/"; | ||
59 | |||
60 | /// <value> | ||
56 | /// Path for the prims file | 61 | /// Path for the prims file |
57 | /// </value> | 62 | /// </value> |
58 | public const string OBJECTS_PATH = "objects/"; | 63 | public const string OBJECTS_PATH = "objects/"; |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 7384e39..44c3411 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -449,9 +449,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
449 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 449 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
450 | { | 450 | { |
451 | if (DebugLevel >= 3) | 451 | if (DebugLevel >= 3) |
452 | m_log.DebugFormat( | 452 | LogIncomingToStreamHandler(request, requestHandler); |
453 | "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", | ||
454 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); | ||
455 | 453 | ||
456 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. | 454 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. |
457 | 455 | ||
@@ -563,9 +561,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
563 | if (DoWeHaveALLSDHandler(request.RawUrl)) | 561 | if (DoWeHaveALLSDHandler(request.RawUrl)) |
564 | { | 562 | { |
565 | if (DebugLevel >= 3) | 563 | if (DebugLevel >= 3) |
566 | m_log.DebugFormat( | 564 | LogIncomingToContentTypeHandler(request); |
567 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
568 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
569 | 565 | ||
570 | buffer = HandleLLSDRequests(request, response); | 566 | buffer = HandleLLSDRequests(request, response); |
571 | } | 567 | } |
@@ -573,18 +569,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
573 | else if (DoWeHaveAHTTPHandler(request.RawUrl)) | 569 | else if (DoWeHaveAHTTPHandler(request.RawUrl)) |
574 | { | 570 | { |
575 | if (DebugLevel >= 3) | 571 | if (DebugLevel >= 3) |
576 | m_log.DebugFormat( | 572 | LogIncomingToContentTypeHandler(request); |
577 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
578 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
579 | 573 | ||
580 | buffer = HandleHTTPRequest(request, response); | 574 | buffer = HandleHTTPRequest(request, response); |
581 | } | 575 | } |
582 | else | 576 | else |
583 | { | 577 | { |
584 | if (DebugLevel >= 3) | 578 | if (DebugLevel >= 3) |
585 | m_log.DebugFormat( | 579 | LogIncomingToXmlRpcHandler(request); |
586 | "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", | ||
587 | request.HttpMethod, request.Url.PathAndQuery); | ||
588 | 580 | ||
589 | // generic login request. | 581 | // generic login request. |
590 | buffer = HandleXmlRpcRequests(request, response); | 582 | buffer = HandleXmlRpcRequests(request, response); |
@@ -654,6 +646,58 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
654 | } | 646 | } |
655 | } | 647 | } |
656 | 648 | ||
649 | private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) | ||
650 | { | ||
651 | m_log.DebugFormat( | ||
652 | "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", | ||
653 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); | ||
654 | |||
655 | if (DebugLevel >= 4) | ||
656 | LogIncomingInDetail(request); | ||
657 | } | ||
658 | |||
659 | private void LogIncomingToContentTypeHandler(OSHttpRequest request) | ||
660 | { | ||
661 | m_log.DebugFormat( | ||
662 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
663 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
664 | |||
665 | if (DebugLevel >= 4) | ||
666 | LogIncomingInDetail(request); | ||
667 | } | ||
668 | |||
669 | private void LogIncomingToXmlRpcHandler(OSHttpRequest request) | ||
670 | { | ||
671 | m_log.DebugFormat( | ||
672 | "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", | ||
673 | request.HttpMethod, request.Url.PathAndQuery); | ||
674 | |||
675 | if (DebugLevel >= 4) | ||
676 | LogIncomingInDetail(request); | ||
677 | } | ||
678 | |||
679 | private void LogIncomingInDetail(OSHttpRequest request) | ||
680 | { | ||
681 | using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8)) | ||
682 | { | ||
683 | string output; | ||
684 | |||
685 | if (DebugLevel == 4) | ||
686 | { | ||
687 | const int sampleLength = 80; | ||
688 | char[] sampleChars = new char[sampleLength]; | ||
689 | reader.Read(sampleChars, 0, sampleLength); | ||
690 | output = string.Format("[BASE HTTP SERVER]: {0}...", new string(sampleChars).Replace("\n", @"\n")); | ||
691 | } | ||
692 | else | ||
693 | { | ||
694 | output = string.Format("[BASE HTTP SERVER]: {0}", reader.ReadToEnd()); | ||
695 | } | ||
696 | |||
697 | m_log.Debug(output); | ||
698 | } | ||
699 | } | ||
700 | |||
657 | private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) | 701 | private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler) |
658 | { | 702 | { |
659 | string bestMatch = null; | 703 | string bestMatch = null; |
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 8dc0e3a..7402c73 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Text; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
@@ -105,12 +106,19 @@ namespace OpenSim.Framework.Servers | |||
105 | public static void RegisterHttpConsoleCommands(ICommandConsole console) | 106 | public static void RegisterHttpConsoleCommands(ICommandConsole console) |
106 | { | 107 | { |
107 | console.Commands.AddCommand( | 108 | console.Commands.AddCommand( |
109 | "Comms", false, "show http-handlers", | ||
110 | "show http-handlers", | ||
111 | "Show all registered http handlers", HandleShowHttpHandlersCommand); | ||
112 | |||
113 | console.Commands.AddCommand( | ||
108 | "Debug", false, "debug http", "debug http [<level>]", | 114 | "Debug", false, "debug http", "debug http [<level>]", |
109 | "Turn on inbound non-poll http request debugging.", | 115 | "Turn on inbound non-poll http request debugging.", |
110 | "If level <= 0, then no extra logging is done.\n" | 116 | "If level <= 0, then no extra logging is done.\n" |
111 | + "If level >= 1, then short warnings are logged when receiving bad input data.\n" | 117 | + "If level >= 1, then short warnings are logged when receiving bad input data.\n" |
112 | + "If level >= 2, then long warnings are logged when receiving bad input data.\n" | 118 | + "If level >= 2, then long warnings are logged when receiving bad input data.\n" |
113 | + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" | 119 | + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" |
120 | + "If level >= 4, then a sample from the beginning of the incoming data is logged.\n" | ||
121 | + "If level >= 5, then the entire incoming data is logged.\n" | ||
114 | + "If no level is specified then the current level is returned.", | 122 | + "If no level is specified then the current level is returned.", |
115 | HandleDebugHttpCommand); | 123 | HandleDebugHttpCommand); |
116 | } | 124 | } |
@@ -136,8 +144,53 @@ namespace OpenSim.Framework.Servers | |||
136 | } | 144 | } |
137 | else | 145 | else |
138 | { | 146 | { |
139 | MainConsole.Instance.Output("Usage: debug http 0..3"); | 147 | MainConsole.Instance.Output("Usage: debug http 0..5"); |
148 | } | ||
149 | } | ||
150 | |||
151 | private static void HandleShowHttpHandlersCommand(string module, string[] args) | ||
152 | { | ||
153 | if (args.Length != 2) | ||
154 | { | ||
155 | MainConsole.Instance.Output("Usage: show http-handlers"); | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | StringBuilder handlers = new StringBuilder(); | ||
160 | |||
161 | lock (m_Servers) | ||
162 | { | ||
163 | foreach (BaseHttpServer httpServer in m_Servers.Values) | ||
164 | { | ||
165 | handlers.AppendFormat( | ||
166 | "Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port); | ||
167 | |||
168 | handlers.AppendFormat("* XMLRPC:\n"); | ||
169 | foreach (String s in httpServer.GetXmlRpcHandlerKeys()) | ||
170 | handlers.AppendFormat("\t{0}\n", s); | ||
171 | |||
172 | handlers.AppendFormat("* HTTP:\n"); | ||
173 | List<String> poll = httpServer.GetPollServiceHandlerKeys(); | ||
174 | foreach (String s in httpServer.GetHTTPHandlerKeys()) | ||
175 | handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); | ||
176 | |||
177 | handlers.AppendFormat("* Agent:\n"); | ||
178 | foreach (String s in httpServer.GetAgentHandlerKeys()) | ||
179 | handlers.AppendFormat("\t{0}\n", s); | ||
180 | |||
181 | handlers.AppendFormat("* LLSD:\n"); | ||
182 | foreach (String s in httpServer.GetLLSDHandlerKeys()) | ||
183 | handlers.AppendFormat("\t{0}\n", s); | ||
184 | |||
185 | handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count); | ||
186 | foreach (String s in httpServer.GetStreamHandlerKeys()) | ||
187 | handlers.AppendFormat("\t{0}\n", s); | ||
188 | |||
189 | handlers.Append("\n"); | ||
190 | } | ||
140 | } | 191 | } |
192 | |||
193 | MainConsole.Instance.Output(handlers.ToString()); | ||
141 | } | 194 | } |
142 | 195 | ||
143 | /// <summary> | 196 | /// <summary> |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 1a383ae..a26e930 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1019,6 +1019,38 @@ namespace OpenSim.Framework | |||
1019 | } | 1019 | } |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | /// <summary> | ||
1023 | /// Copy data from one stream to another, leaving the read position of both streams at the beginning. | ||
1024 | /// </summary> | ||
1025 | /// <param name='inputStream'> | ||
1026 | /// Input stream. Must be seekable. | ||
1027 | /// </param> | ||
1028 | /// <exception cref='ArgumentException'> | ||
1029 | /// Thrown if the input stream is not seekable. | ||
1030 | /// </exception> | ||
1031 | public static Stream Copy(Stream inputStream) | ||
1032 | { | ||
1033 | if (!inputStream.CanSeek) | ||
1034 | throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek"); | ||
1035 | |||
1036 | const int readSize = 256; | ||
1037 | byte[] buffer = new byte[readSize]; | ||
1038 | MemoryStream ms = new MemoryStream(); | ||
1039 | |||
1040 | int count = inputStream.Read(buffer, 0, readSize); | ||
1041 | |||
1042 | while (count > 0) | ||
1043 | { | ||
1044 | ms.Write(buffer, 0, count); | ||
1045 | count = inputStream.Read(buffer, 0, readSize); | ||
1046 | } | ||
1047 | |||
1048 | ms.Position = 0; | ||
1049 | inputStream.Position = 0; | ||
1050 | |||
1051 | return ms; | ||
1052 | } | ||
1053 | |||
1022 | public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) | 1054 | public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) |
1023 | { | 1055 | { |
1024 | return SendXmlRpcCommand(url, methodName, args); | 1056 | return SendXmlRpcCommand(url, methodName, args); |