aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs230
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs22
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs107
3 files changed, 228 insertions, 131 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 691b45a..29593e5 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -54,8 +54,23 @@ namespace OpenSim.Framework.Servers.HttpServer
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); 55 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
56 56
57 /// <summary>
58 /// Gets or sets the debug level.
59 /// </summary>
60 /// <value>
61 /// See MainServer.DebugLevel.
62 /// </value>
57 public int DebugLevel { get; set; } 63 public int DebugLevel { get; set; }
58 64
65 /// <summary>
66 /// Request number for diagnostic purposes.
67 /// </summary>
68 /// <remarks>
69 /// This is an internal number. In some debug situations an external number may also be supplied in the
70 /// opensim-request-id header but we are not currently logging this.
71 /// </remarks>
72 public int RequestNumber { get; private set; }
73
59 private volatile int NotSocketErrors = 0; 74 private volatile int NotSocketErrors = 0;
60 public volatile bool HTTPDRunning = false; 75 public volatile bool HTTPDRunning = false;
61 76
@@ -67,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer
67 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>(); 82 protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
68 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); 83 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
69 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); 84 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
70 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); 85// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
71 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = 86 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
72 new Dictionary<string, PollServiceEventArgs>(); 87 new Dictionary<string, PollServiceEventArgs>();
73 88
@@ -245,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer
245 return new List<string>(m_pollHandlers.Keys); 260 return new List<string>(m_pollHandlers.Keys);
246 } 261 }
247 262
248 // Note that the agent string is provided simply to differentiate 263// // Note that the agent string is provided simply to differentiate
249 // the handlers - it is NOT required to be an actual agent header 264// // the handlers - it is NOT required to be an actual agent header
250 // value. 265// // value.
251 public bool AddAgentHandler(string agent, IHttpAgentHandler handler) 266// public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
252 { 267// {
253 lock (m_agentHandlers) 268// lock (m_agentHandlers)
254 { 269// {
255 if (!m_agentHandlers.ContainsKey(agent)) 270// if (!m_agentHandlers.ContainsKey(agent))
256 { 271// {
257 m_agentHandlers.Add(agent, handler); 272// m_agentHandlers.Add(agent, handler);
258 return true; 273// return true;
259 } 274// }
260 } 275// }
261 276//
262 //must already have a handler for that path so return false 277// //must already have a handler for that path so return false
263 return false; 278// return false;
264 } 279// }
265 280//
266 public List<string> GetAgentHandlerKeys() 281// public List<string> GetAgentHandlerKeys()
267 { 282// {
268 lock (m_agentHandlers) 283// lock (m_agentHandlers)
269 return new List<string>(m_agentHandlers.Keys); 284// return new List<string>(m_agentHandlers.Keys);
270 } 285// }
271 286
272 public bool AddLLSDHandler(string path, LLSDMethod handler) 287 public bool AddLLSDHandler(string path, LLSDMethod handler)
273 { 288 {
@@ -296,6 +311,8 @@ namespace OpenSim.Framework.Servers.HttpServer
296 311
297 private void OnRequest(object source, RequestEventArgs args) 312 private void OnRequest(object source, RequestEventArgs args)
298 { 313 {
314 RequestNumber++;
315
299 try 316 try
300 { 317 {
301 IHttpClientContext context = (IHttpClientContext)source; 318 IHttpClientContext context = (IHttpClientContext)source;
@@ -405,7 +422,6 @@ namespace OpenSim.Framework.Servers.HttpServer
405 string requestMethod = request.HttpMethod; 422 string requestMethod = request.HttpMethod;
406 string uriString = request.RawUrl; 423 string uriString = request.RawUrl;
407 424
408// string reqnum = "unknown";
409 int requestStartTick = Environment.TickCount; 425 int requestStartTick = Environment.TickCount;
410 426
411 // Will be adjusted later on. 427 // Will be adjusted later on.
@@ -422,22 +438,22 @@ namespace OpenSim.Framework.Servers.HttpServer
422 438
423 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 439 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
424 440
425 // This is the REST agent interface. We require an agent to properly identify 441// // This is the REST agent interface. We require an agent to properly identify
426 // itself. If the REST handler recognizes the prefix it will attempt to 442// // itself. If the REST handler recognizes the prefix it will attempt to
427 // satisfy the request. If it is not recognizable, and no damage has occurred 443// // satisfy the request. If it is not recognizable, and no damage has occurred
428 // the request can be passed through to the other handlers. This is a low 444// // the request can be passed through to the other handlers. This is a low
429 // probability event; if a request is matched it is normally expected to be 445// // probability event; if a request is matched it is normally expected to be
430 // handled 446// // handled
431 IHttpAgentHandler agentHandler; 447// IHttpAgentHandler agentHandler;
432 448//
433 if (TryGetAgentHandler(request, response, out agentHandler)) 449// if (TryGetAgentHandler(request, response, out agentHandler))
434 { 450// {
435 if (HandleAgentRequest(agentHandler, request, response)) 451// if (HandleAgentRequest(agentHandler, request, response))
436 { 452// {
437 requestEndTick = Environment.TickCount; 453// requestEndTick = Environment.TickCount;
438 return; 454// return;
439 } 455// }
440 } 456// }
441 457
442 //response.KeepAlive = true; 458 //response.KeepAlive = true;
443 response.SendChunked = false; 459 response.SendChunked = false;
@@ -529,8 +545,8 @@ namespace OpenSim.Framework.Servers.HttpServer
529 545
530 if (DebugLevel >= 3) 546 if (DebugLevel >= 3)
531 m_log.DebugFormat( 547 m_log.DebugFormat(
532 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", 548 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
533 request.ContentType, request.HttpMethod, request.Url.PathAndQuery); 549 RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
534 550
535 buffer = HandleHTTPRequest(request, response); 551 buffer = HandleHTTPRequest(request, response);
536 break; 552 break;
@@ -541,8 +557,8 @@ namespace OpenSim.Framework.Servers.HttpServer
541 557
542 if (DebugLevel >= 3) 558 if (DebugLevel >= 3)
543 m_log.DebugFormat( 559 m_log.DebugFormat(
544 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", 560 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
545 request.ContentType, request.HttpMethod, request.Url.PathAndQuery); 561 RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
546 562
547 buffer = HandleLLSDRequests(request, response); 563 buffer = HandleLLSDRequests(request, response);
548 break; 564 break;
@@ -620,11 +636,11 @@ namespace OpenSim.Framework.Servers.HttpServer
620 } 636 }
621 catch (IOException e) 637 catch (IOException e)
622 { 638 {
623 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); 639 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e);
624 } 640 }
625 catch (Exception e) 641 catch (Exception e)
626 { 642 {
627 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); 643 m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e);
628 SendHTML500(response); 644 SendHTML500(response);
629 } 645 }
630 finally 646 finally
@@ -635,12 +651,21 @@ namespace OpenSim.Framework.Servers.HttpServer
635 if (tickdiff > 3000 && requestHandler.Name != "GetTexture") 651 if (tickdiff > 3000 && requestHandler.Name != "GetTexture")
636 { 652 {
637 m_log.InfoFormat( 653 m_log.InfoFormat(
638 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", 654 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
655 RequestNumber,
639 requestMethod, 656 requestMethod,
640 uriString, 657 uriString,
641 requestHandler != null ? requestHandler.Name : "", 658 requestHandler != null ? requestHandler.Name : "",
642 requestHandler != null ? requestHandler.Description : "", 659 requestHandler != null ? requestHandler.Description : "",
643 request.RemoteIPEndPoint.ToString(), 660 request.RemoteIPEndPoint,
661 tickdiff);
662 }
663 else if (DebugLevel >= 4)
664 {
665 m_log.DebugFormat(
666 "[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms",
667 RequestNumber,
668 Port,
644 tickdiff); 669 tickdiff);
645 } 670 }
646 } 671 }
@@ -649,30 +674,45 @@ namespace OpenSim.Framework.Servers.HttpServer
649 private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) 674 private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
650 { 675 {
651 m_log.DebugFormat( 676 m_log.DebugFormat(
652 "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", 677 "[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}",
653 request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); 678 RequestNumber,
654 679 Port,
655 if (DebugLevel >= 4) 680 request.HttpMethod,
681 request.Url.PathAndQuery,
682 requestHandler.Name,
683 requestHandler.Description,
684 request.RemoteIPEndPoint);
685
686 if (DebugLevel >= 5)
656 LogIncomingInDetail(request); 687 LogIncomingInDetail(request);
657 } 688 }
658 689
659 private void LogIncomingToContentTypeHandler(OSHttpRequest request) 690 private void LogIncomingToContentTypeHandler(OSHttpRequest request)
660 { 691 {
661 m_log.DebugFormat( 692 m_log.DebugFormat(
662 "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", 693 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
663 request.ContentType, request.HttpMethod, request.Url.PathAndQuery); 694 RequestNumber,
664 695 Port,
665 if (DebugLevel >= 4) 696 request.ContentType,
697 request.HttpMethod,
698 request.Url.PathAndQuery,
699 request.RemoteIPEndPoint);
700
701 if (DebugLevel >= 5)
666 LogIncomingInDetail(request); 702 LogIncomingInDetail(request);
667 } 703 }
668 704
669 private void LogIncomingToXmlRpcHandler(OSHttpRequest request) 705 private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
670 { 706 {
671 m_log.DebugFormat( 707 m_log.DebugFormat(
672 "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", 708 "[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}",
673 request.HttpMethod, request.Url.PathAndQuery); 709 RequestNumber,
674 710 Port,
675 if (DebugLevel >= 4) 711 request.HttpMethod,
712 request.Url.PathAndQuery,
713 request.RemoteIPEndPoint);
714
715 if (DebugLevel >= 5)
676 LogIncomingInDetail(request); 716 LogIncomingInDetail(request);
677 } 717 }
678 718
@@ -682,7 +722,7 @@ namespace OpenSim.Framework.Servers.HttpServer
682 { 722 {
683 string output; 723 string output;
684 724
685 if (DebugLevel == 4) 725 if (DebugLevel == 5)
686 { 726 {
687 const int sampleLength = 80; 727 const int sampleLength = 80;
688 char[] sampleChars = new char[sampleLength]; 728 char[] sampleChars = new char[sampleLength];
@@ -790,24 +830,24 @@ namespace OpenSim.Framework.Servers.HttpServer
790 } 830 }
791 } 831 }
792 832
793 private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) 833// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
794 { 834// {
795 agentHandler = null; 835// agentHandler = null;
796 836//
797 lock (m_agentHandlers) 837// lock (m_agentHandlers)
798 { 838// {
799 foreach (IHttpAgentHandler handler in m_agentHandlers.Values) 839// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
800 { 840// {
801 if (handler.Match(request, response)) 841// if (handler.Match(request, response))
802 { 842// {
803 agentHandler = handler; 843// agentHandler = handler;
804 return true; 844// return true;
805 } 845// }
806 } 846// }
807 } 847// }
808 848//
809 return false; 849// return false;
810 } 850// }
811 851
812 /// <summary> 852 /// <summary>
813 /// Try all the registered xmlrpc handlers when an xmlrpc request is received. 853 /// Try all the registered xmlrpc handlers when an xmlrpc request is received.
@@ -1778,21 +1818,21 @@ namespace OpenSim.Framework.Servers.HttpServer
1778 m_pollHandlers.Remove(path); 1818 m_pollHandlers.Remove(path);
1779 } 1819 }
1780 1820
1781 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) 1821// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
1782 { 1822// {
1783 lock (m_agentHandlers) 1823// lock (m_agentHandlers)
1784 { 1824// {
1785 IHttpAgentHandler foundHandler; 1825// IHttpAgentHandler foundHandler;
1786 1826//
1787 if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler) 1827// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
1788 { 1828// {
1789 m_agentHandlers.Remove(agent); 1829// m_agentHandlers.Remove(agent);
1790 return true; 1830// return true;
1791 } 1831// }
1792 } 1832// }
1793 1833//
1794 return false; 1834// return false;
1795 } 1835// }
1796 1836
1797 public void RemoveXmlRPCHandler(string method) 1837 public void RemoveXmlRPCHandler(string method)
1798 { 1838 {
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index db58f6f..0bd3aae 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
41 uint Port { get; } 41 uint Port { get; }
42 bool UseSSL { get; } 42 bool UseSSL { get; }
43 43
44 // Note that the agent string is provided simply to differentiate 44// // Note that the agent string is provided simply to differentiate
45 // the handlers - it is NOT required to be an actual agent header 45// // the handlers - it is NOT required to be an actual agent header
46 // value. 46// // value.
47 bool AddAgentHandler(string agent, IHttpAgentHandler handler); 47// bool AddAgentHandler(string agent, IHttpAgentHandler handler);
48 48
49 /// <summary> 49 /// <summary>
50 /// Add a handler for an HTTP request. 50 /// Add a handler for an HTTP request.
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
106 106
107 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); 107 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
108 108
109 /// <summary> 109// /// <summary>
110 /// Remove the agent if it is registered. 110// /// Remove the agent if it is registered.
111 /// </summary> 111// /// </summary>
112 /// <param name="agent"></param> 112// /// <param name="agent"></param>
113 /// <param name="handler"></param> 113// /// <param name="handler"></param>
114 /// <returns></returns> 114// /// <returns></returns>
115 bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); 115// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
116 116
117 /// <summary> 117 /// <summary>
118 /// Remove an HTTP handler 118 /// Remove an HTTP handler
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index 7402c73..4b61b18 100644
--- a/OpenSim/Framework/Servers/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -48,9 +48,12 @@ namespace OpenSim.Framework.Servers
48 /// Control the printing of certain debug messages. 48 /// Control the printing of certain debug messages.
49 /// </summary> 49 /// </summary>
50 /// <remarks> 50 /// <remarks>
51 /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. 51 /// If DebugLevel >= 1 then short warnings are logged when receiving bad input data.
52 /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. 52 /// If DebugLevel >= 2 then long warnings are logged when receiving bad input data.
53 /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. 53 /// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged.
54 /// If DebugLevel >= 4 then the time taken to fulfill the request is logged.
55 /// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged.
56 /// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged.
54 /// </remarks> 57 /// </remarks>
55 public static int DebugLevel 58 public static int DebugLevel
56 { 59 {
@@ -102,7 +105,6 @@ namespace OpenSim.Framework.Servers
102 get { return new Dictionary<uint, BaseHttpServer>(m_Servers); } 105 get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
103 } 106 }
104 107
105
106 public static void RegisterHttpConsoleCommands(ICommandConsole console) 108 public static void RegisterHttpConsoleCommands(ICommandConsole console)
107 { 109 {
108 console.Commands.AddCommand( 110 console.Commands.AddCommand(
@@ -111,15 +113,20 @@ namespace OpenSim.Framework.Servers
111 "Show all registered http handlers", HandleShowHttpHandlersCommand); 113 "Show all registered http handlers", HandleShowHttpHandlersCommand);
112 114
113 console.Commands.AddCommand( 115 console.Commands.AddCommand(
114 "Debug", false, "debug http", "debug http [<level>]", 116 "Debug", false, "debug http", "debug http <in|out|all> [<level>]",
115 "Turn on inbound non-poll http request debugging.", 117 "Turn on http request logging.",
116 "If level <= 0, then no extra logging is done.\n" 118 "If in or all and\n"
117 + "If level >= 1, then short warnings are logged when receiving bad input data.\n" 119 + " level <= 0 then no extra logging is done.\n"
118 + "If level >= 2, then long warnings are logged when receiving bad input data.\n" 120 + " level >= 1 then short warnings are logged when receiving bad input data.\n"
119 + "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n" 121 + " level >= 2 then long warnings are logged when receiving bad input data.\n"
120 + "If level >= 4, then a sample from the beginning of the incoming data is logged.\n" 122 + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
121 + "If level >= 5, then the entire incoming data is logged.\n" 123 + " level >= 4 then the time taken to fulfill the request is logged.\n"
122 + "If no level is specified then the current level is returned.", 124 + " level >= 5 then a sample from the beginning of the incoming data is logged.\n"
125 + " level >= 6 then the entire incoming data is logged.\n"
126 + " no level is specified then the current level is returned.\n\n"
127 + "If out or all and\n"
128 + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
129 + " level >= 4 then the time taken to fulfill the request is logged.\n",
123 HandleDebugHttpCommand); 130 HandleDebugHttpCommand);
124 } 131 }
125 132
@@ -127,24 +134,74 @@ namespace OpenSim.Framework.Servers
127 /// Turn on some debugging values for OpenSim. 134 /// Turn on some debugging values for OpenSim.
128 /// </summary> 135 /// </summary>
129 /// <param name="args"></param> 136 /// <param name="args"></param>
130 private static void HandleDebugHttpCommand(string module, string[] args) 137 private static void HandleDebugHttpCommand(string module, string[] cmdparams)
131 { 138 {
132 if (args.Length == 3) 139 if (cmdparams.Length < 3)
140 {
141 MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..6");
142 return;
143 }
144
145 bool inReqs = false;
146 bool outReqs = false;
147 bool allReqs = false;
148
149 string subCommand = cmdparams[2];
150
151 if (subCommand.ToLower() == "in")
152 {
153 inReqs = true;
154 }
155 else if (subCommand.ToLower() == "out")
156 {
157 outReqs = true;
158 }
159 else if (subCommand.ToLower() == "all")
160 {
161 allReqs = true;
162 }
163 else
164 {
165 MainConsole.Instance.Output("You must specify in, out or all");
166 return;
167 }
168
169 if (cmdparams.Length >= 4)
133 { 170 {
171 string rawNewDebug = cmdparams[3];
134 int newDebug; 172 int newDebug;
135 if (int.TryParse(args[2], out newDebug)) 173
174 if (!int.TryParse(rawNewDebug, out newDebug))
175 {
176 MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug);
177 return;
178 }
179
180 if (newDebug < 0 || newDebug > 5)
181 {
182 MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..5", newDebug);
183 return;
184 }
185
186 if (allReqs || inReqs)
136 { 187 {
137 MainServer.DebugLevel = newDebug; 188 MainServer.DebugLevel = newDebug;
138 MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug); 189 MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug);
190 }
191
192 if (allReqs || outReqs)
193 {
194 WebUtil.DebugLevel = newDebug;
195 MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug);
139 } 196 }
140 }
141 else if (args.Length == 2)
142 {
143 MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel);
144 } 197 }
145 else 198 else
146 { 199 {
147 MainConsole.Instance.Output("Usage: debug http 0..5"); 200 if (allReqs || inReqs)
201 MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel);
202
203 if (allReqs || outReqs)
204 MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel);
148 } 205 }
149 } 206 }
150 207
@@ -174,9 +231,9 @@ namespace OpenSim.Framework.Servers
174 foreach (String s in httpServer.GetHTTPHandlerKeys()) 231 foreach (String s in httpServer.GetHTTPHandlerKeys())
175 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); 232 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
176 233
177 handlers.AppendFormat("* Agent:\n"); 234// handlers.AppendFormat("* Agent:\n");
178 foreach (String s in httpServer.GetAgentHandlerKeys()) 235// foreach (String s in httpServer.GetAgentHandlerKeys())
179 handlers.AppendFormat("\t{0}\n", s); 236// handlers.AppendFormat("\t{0}\n", s);
180 237
181 handlers.AppendFormat("* LLSD:\n"); 238 handlers.AppendFormat("* LLSD:\n");
182 foreach (String s in httpServer.GetLLSDHandlerKeys()) 239 foreach (String s in httpServer.GetLLSDHandlerKeys())