aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-29 16:15:52 +0000
committerJustin Clark-Casey (justincc)2011-11-29 16:15:52 +0000
commitb6b0bc7b32ec5009eb482d51d0e9ff711e6ec022 (patch)
tree151e52c3351e14f4e212cd26ba9b04ff32c394a0 /OpenSim/Framework
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-b6b0bc7b32ec5009eb482d51d0e9ff711e6ec022.zip
opensim-SC_OLD-b6b0bc7b32ec5009eb482d51d0e9ff711e6ec022.tar.gz
opensim-SC_OLD-b6b0bc7b32ec5009eb482d51d0e9ff711e6ec022.tar.bz2
opensim-SC_OLD-b6b0bc7b32ec5009eb482d51d0e9ff711e6ec022.tar.xz
Add "debug http" command for currently simple extra debug logging of non-event queue inbound http requests to a simulator
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs55
1 files changed, 43 insertions, 12 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";