aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs55
-rw-r--r--OpenSim/Region/Application/OpenSim.cs26
2 files changed, 67 insertions, 14 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 3aed9a8..689a292 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -79,6 +79,11 @@ namespace OpenSim.Framework.Servers.HttpServer
79 79
80 private PollServiceRequestManager m_PollServiceManager; 80 private PollServiceRequestManager m_PollServiceManager;
81 81
82 /// <summary>
83 /// Control the printing of certain debug messages.
84 /// </summary>
85 public int DebugLevel { get; set; }
86
82 public uint SSLPort 87 public uint SSLPort
83 { 88 {
84 get { return m_sslport; } 89 get { return m_sslport; }
@@ -442,17 +447,20 @@ namespace OpenSim.Framework.Servers.HttpServer
442 string path = request.RawUrl; 447 string path = request.RawUrl;
443 string handlerKey = GetHandlerKey(request.HttpMethod, path); 448 string handlerKey = GetHandlerKey(request.HttpMethod, path);
444 449
445// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 450 if (DebugLevel >= 1)
451 m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
446 452
447 if (TryGetStreamHandler(handlerKey, out requestHandler)) 453 if (TryGetStreamHandler(handlerKey, out requestHandler))
448 { 454 {
449 //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); 455 if (DebugLevel >= 2)
456 m_log.DebugFormat(
457 "[BASE HTTP SERVER]: Found stream handler {0} for request to {1}", handlerKey, path);
458
450 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. 459 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
451 byte[] buffer = null; 460 byte[] buffer = null;
452 461
453 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. 462 response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
454 463
455
456 if (requestHandler is IStreamedRequestHandler) 464 if (requestHandler is IStreamedRequestHandler)
457 { 465 {
458 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; 466 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
@@ -556,6 +564,7 @@ namespace OpenSim.Framework.Servers.HttpServer
556 { 564 {
557 m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); 565 m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
558 } 566 }
567
559 return; 568 return;
560 } 569 }
561 570
@@ -566,7 +575,11 @@ namespace OpenSim.Framework.Servers.HttpServer
566 if (strAccept.Contains("application/llsd+xml") || 575 if (strAccept.Contains("application/llsd+xml") ||
567 strAccept.Contains("application/llsd+json")) 576 strAccept.Contains("application/llsd+json"))
568 { 577 {
569 //m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header"); 578 if (DebugLevel >= 2)
579 m_log.DebugFormat(
580 "[BASE HTTP SERVER]: Found an application/llsd+xml accept header for request to {0}",
581 path);
582
570 HandleLLSDRequests(request, response); 583 HandleLLSDRequests(request, response);
571 return; 584 return;
572 } 585 }
@@ -577,15 +590,24 @@ namespace OpenSim.Framework.Servers.HttpServer
577 { 590 {
578 case null: 591 case null:
579 case "text/html": 592 case "text/html":
580// m_log.DebugFormat( 593
581// "[BASE HTTP SERVER]: Found a text/html content type for request {0}", request.RawUrl); 594 if (DebugLevel >= 2)
595 m_log.DebugFormat(
596 "[BASE HTTP SERVER]: Found a {0} content type for request to {1}",
597 request.ContentType, path);
598
582 HandleHTTPRequest(request, response); 599 HandleHTTPRequest(request, response);
583 return; 600 return;
584 601
585 case "application/llsd+xml": 602 case "application/llsd+xml":
586 case "application/xml+llsd": 603 case "application/xml+llsd":
587 case "application/llsd+json": 604 case "application/llsd+json":
588 //m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type"); 605
606 if (DebugLevel >= 2)
607 m_log.DebugFormat(
608 "[BASE HTTP SERVER]: Found a {0} content type for request to {1}",
609 request.ContentType, path);
610
589 HandleLLSDRequests(request, response); 611 HandleLLSDRequests(request, response);
590 return; 612 return;
591 613
@@ -602,7 +624,10 @@ namespace OpenSim.Framework.Servers.HttpServer
602 //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); 624 //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler");
603 if (DoWeHaveALLSDHandler(request.RawUrl)) 625 if (DoWeHaveALLSDHandler(request.RawUrl))
604 { 626 {
605 //m_log.Info("[Debug BASE HTTP SERVER]: Found LLSD Handler"); 627 if (DebugLevel >= 2)
628 m_log.DebugFormat(
629 "[BASE HTTP SERVER]: Found an LLSD handler for request to {0}", path);
630
606 HandleLLSDRequests(request, response); 631 HandleLLSDRequests(request, response);
607 return; 632 return;
608 } 633 }
@@ -610,12 +635,18 @@ namespace OpenSim.Framework.Servers.HttpServer
610// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); 635// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
611 if (DoWeHaveAHTTPHandler(request.RawUrl)) 636 if (DoWeHaveAHTTPHandler(request.RawUrl))
612 { 637 {
613// m_log.DebugFormat("[BASE HTTP SERVER]: Found HTTP Handler for request {0}", request.RawUrl); 638 if (DebugLevel >= 2)
639 m_log.DebugFormat(
640 "[BASE HTTP SERVER]: Found an HTTP handler for request to {0}", path);
641
614 HandleHTTPRequest(request, response); 642 HandleHTTPRequest(request, response);
615 return; 643 return;
616 } 644 }
617 645
618 //m_log.Info("[Debug BASE HTTP SERVER]: Generic XMLRPC"); 646 if (DebugLevel >= 2)
647 m_log.DebugFormat(
648 "[BASE HTTP SERVER]: Treating request to {0} as a generic XMLRPC request", path);
649
619 // generic login request. 650 // generic login request.
620 HandleXmlRpcRequests(request, response); 651 HandleXmlRpcRequests(request, response);
621 652
@@ -978,7 +1009,6 @@ namespace OpenSim.Framework.Servers.HttpServer
978 1009
979 if (llsdRequest != null)// && m_defaultLlsdHandler != null) 1010 if (llsdRequest != null)// && m_defaultLlsdHandler != null)
980 { 1011 {
981
982 LLSDMethod llsdhandler = null; 1012 LLSDMethod llsdhandler = null;
983 1013
984 if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV) 1014 if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV)
@@ -1002,13 +1032,14 @@ namespace OpenSim.Framework.Servers.HttpServer
1002 llsdResponse = GenerateNoLLSDHandlerResponse(); 1032 llsdResponse = GenerateNoLLSDHandlerResponse();
1003 } 1033 }
1004 } 1034 }
1005
1006 } 1035 }
1007 else 1036 else
1008 { 1037 {
1009 llsdResponse = GenerateNoLLSDHandlerResponse(); 1038 llsdResponse = GenerateNoLLSDHandlerResponse();
1010 } 1039 }
1040
1011 byte[] buffer = new byte[0]; 1041 byte[] buffer = new byte[0];
1042
1012 if (llsdResponse.ToString() == "shutdown404!") 1043 if (llsdResponse.ToString() == "shutdown404!")
1013 { 1044 {
1014 response.ContentType = "text/plain"; 1045 response.ContentType = "text/plain";
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index ee26e4f..f4ed32e 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -242,6 +242,14 @@ namespace OpenSim
242 + "If an avatar name is given then only packets from that avatar are logged", 242 + "If an avatar name is given then only packets from that avatar are logged",
243 Debug); 243 Debug);
244 244
245 m_console.Commands.AddCommand("region", false, "debug http",
246 "debug http <level>",
247 "Turn on inbound http request debugging for everything except the event queue (see debug eq)."
248 + "If level >= 2 then the handler used to service the request is logged.\n"
249 + "If level >= 1 then incoming HTTP requests are logged.\n"
250 + "If level <= 0 then no extra http logging is done.\n",
251 Debug);
252
245 m_console.Commands.AddCommand("region", false, "debug scene", 253 m_console.Commands.AddCommand("region", false, "debug scene",
246 "debug scene <cripting> <collisions> <physics>", 254 "debug scene <cripting> <collisions> <physics>",
247 "Turn on scene debugging", Debug); 255 "Turn on scene debugging", Debug);
@@ -889,10 +897,24 @@ namespace OpenSim
889 } 897 }
890 else 898 else
891 { 899 {
892 MainConsole.Instance.Output("packet debug should be 0..255"); 900 MainConsole.Instance.Output("Usage: debug packet 0..255");
901 }
902 }
903
904 break;
905
906 case "http":
907 if (args.Length == 3)
908 {
909 int newDebug;
910 if (int.TryParse(args[2], out newDebug))
911 {
912 MainServer.Instance.DebugLevel = newDebug;
913 break;
893 } 914 }
894 } 915 }
895 916
917 MainConsole.Instance.Output("Usage: debug http 0..2");
896 break; 918 break;
897 919
898 case "scene": 920 case "scene":
@@ -917,7 +939,7 @@ namespace OpenSim
917 } 939 }
918 else 940 else
919 { 941 {
920 MainConsole.Instance.Output("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); 942 MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
921 } 943 }
922 944
923 break; 945 break;