diff options
author | Melanie | 2011-12-01 12:16:59 +0000 |
---|---|---|
committer | Melanie | 2011-12-01 12:16:59 +0000 |
commit | b60ff651a3912f7d7830cac40752218efba858d8 (patch) | |
tree | ba22de2341b996cfeb1f7da31f650e206cb1d76f /OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |
parent | Merge branch 'master' into bigmerge (diff) | |
parent | Provide more user feedback when "debug http" is set (diff) | |
download | opensim-SC_OLD-b60ff651a3912f7d7830cac40752218efba858d8.zip opensim-SC_OLD-b60ff651a3912f7d7830cac40752218efba858d8.tar.gz opensim-SC_OLD-b60ff651a3912f7d7830cac40752218efba858d8.tar.bz2 opensim-SC_OLD-b60ff651a3912f7d7830cac40752218efba858d8.tar.xz |
Merge branch 'master' into bigmerge
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index b45ed7b..04739fe 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,18 @@ 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); | ||
446 | |||
447 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 450 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
448 | { | 451 | { |
449 | //m_log.Debug("[BASE HTTP SERVER]: Found Stream Handler"); | 452 | if (DebugLevel >= 1) |
453 | m_log.DebugFormat( | ||
454 | "[BASE HTTP SERVER]: Found stream handler for {0} {1}", | ||
455 | request.HttpMethod, request.Url.PathAndQuery); | ||
456 | |||
450 | // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. | 457 | // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. |
451 | byte[] buffer = null; | 458 | byte[] buffer = null; |
452 | 459 | ||
453 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. | 460 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. |
454 | 461 | ||
455 | |||
456 | if (requestHandler is IStreamedRequestHandler) | 462 | if (requestHandler is IStreamedRequestHandler) |
457 | { | 463 | { |
458 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; | 464 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; |
@@ -480,7 +486,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
480 | string[] querystringkeys = request.QueryString.AllKeys; | 486 | string[] querystringkeys = request.QueryString.AllKeys; |
481 | string[] rHeaders = request.Headers.AllKeys; | 487 | string[] rHeaders = request.Headers.AllKeys; |
482 | 488 | ||
483 | |||
484 | foreach (string queryname in querystringkeys) | 489 | foreach (string queryname in querystringkeys) |
485 | { | 490 | { |
486 | keysvals.Add(queryname, request.QueryString[queryname]); | 491 | keysvals.Add(queryname, request.QueryString[queryname]); |
@@ -556,6 +561,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
556 | { | 561 | { |
557 | m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); | 562 | m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); |
558 | } | 563 | } |
564 | |||
559 | return; | 565 | return; |
560 | } | 566 | } |
561 | 567 | ||
@@ -566,7 +572,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
566 | if (strAccept.Contains("application/llsd+xml") || | 572 | if (strAccept.Contains("application/llsd+xml") || |
567 | strAccept.Contains("application/llsd+json")) | 573 | strAccept.Contains("application/llsd+json")) |
568 | { | 574 | { |
569 | //m_log.Info("[Debug BASE HTTP SERVER]: Found an application/llsd+xml accept header"); | 575 | if (DebugLevel >= 1) |
576 | m_log.DebugFormat( | ||
577 | "[BASE HTTP SERVER]: Found application/llsd+xml accept header handler for {0} {1}", | ||
578 | request.HttpMethod, request.Url.PathAndQuery); | ||
579 | |||
570 | HandleLLSDRequests(request, response); | 580 | HandleLLSDRequests(request, response); |
571 | return; | 581 | return; |
572 | } | 582 | } |
@@ -577,15 +587,24 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
577 | { | 587 | { |
578 | case null: | 588 | case null: |
579 | case "text/html": | 589 | case "text/html": |
580 | // m_log.DebugFormat( | 590 | |
581 | // "[BASE HTTP SERVER]: Found a text/html content type for request {0}", request.RawUrl); | 591 | if (DebugLevel >= 1) |
592 | m_log.DebugFormat( | ||
593 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
594 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
595 | |||
582 | HandleHTTPRequest(request, response); | 596 | HandleHTTPRequest(request, response); |
583 | return; | 597 | return; |
584 | 598 | ||
585 | case "application/llsd+xml": | 599 | case "application/llsd+xml": |
586 | case "application/xml+llsd": | 600 | case "application/xml+llsd": |
587 | case "application/llsd+json": | 601 | case "application/llsd+json": |
588 | //m_log.Info("[Debug BASE HTTP SERVER]: found a application/llsd+xml content type"); | 602 | |
603 | if (DebugLevel >= 1) | ||
604 | m_log.DebugFormat( | ||
605 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
606 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
607 | |||
589 | HandleLLSDRequests(request, response); | 608 | HandleLLSDRequests(request, response); |
590 | return; | 609 | return; |
591 | 610 | ||
@@ -602,7 +621,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
602 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); | 621 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); |
603 | if (DoWeHaveALLSDHandler(request.RawUrl)) | 622 | if (DoWeHaveALLSDHandler(request.RawUrl)) |
604 | { | 623 | { |
605 | //m_log.Info("[Debug BASE HTTP SERVER]: Found LLSD Handler"); | 624 | if (DebugLevel >= 1) |
625 | m_log.DebugFormat( | ||
626 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
627 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
628 | |||
606 | HandleLLSDRequests(request, response); | 629 | HandleLLSDRequests(request, response); |
607 | return; | 630 | return; |
608 | } | 631 | } |
@@ -610,12 +633,20 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
610 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); | 633 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); |
611 | if (DoWeHaveAHTTPHandler(request.RawUrl)) | 634 | if (DoWeHaveAHTTPHandler(request.RawUrl)) |
612 | { | 635 | { |
613 | // m_log.DebugFormat("[BASE HTTP SERVER]: Found HTTP Handler for request {0}", request.RawUrl); | 636 | if (DebugLevel >= 1) |
637 | m_log.DebugFormat( | ||
638 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | ||
639 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | ||
640 | |||
614 | HandleHTTPRequest(request, response); | 641 | HandleHTTPRequest(request, response); |
615 | return; | 642 | return; |
616 | } | 643 | } |
617 | 644 | ||
618 | //m_log.Info("[Debug BASE HTTP SERVER]: Generic XMLRPC"); | 645 | if (DebugLevel >= 1) |
646 | m_log.DebugFormat( | ||
647 | "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", | ||
648 | request.HttpMethod, request.Url.PathAndQuery); | ||
649 | |||
619 | // generic login request. | 650 | // generic login request. |
620 | HandleXmlRpcRequests(request, response); | 651 | HandleXmlRpcRequests(request, response); |
621 | 652 | ||
@@ -872,7 +903,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
872 | byte[] buf = Encoding.UTF8.GetBytes("Not found"); | 903 | byte[] buf = Encoding.UTF8.GetBytes("Not found"); |
873 | response.KeepAlive = false; | 904 | response.KeepAlive = false; |
874 | 905 | ||
875 | m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); | 906 | m_log.ErrorFormat( |
907 | "[BASE HTTP SERVER]: Handler not found for http request {0} {1}", | ||
908 | request.HttpMethod, request.Url.PathAndQuery); | ||
876 | 909 | ||
877 | response.SendChunked = false; | 910 | response.SendChunked = false; |
878 | response.ContentLength64 = buf.Length; | 911 | response.ContentLength64 = buf.Length; |
@@ -978,7 +1011,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
978 | 1011 | ||
979 | if (llsdRequest != null)// && m_defaultLlsdHandler != null) | 1012 | if (llsdRequest != null)// && m_defaultLlsdHandler != null) |
980 | { | 1013 | { |
981 | |||
982 | LLSDMethod llsdhandler = null; | 1014 | LLSDMethod llsdhandler = null; |
983 | 1015 | ||
984 | if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV) | 1016 | if (TryGetLLSDHandler(request.RawUrl, out llsdhandler) && !LegacyLLSDLoginLibOMV) |
@@ -1002,13 +1034,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1002 | llsdResponse = GenerateNoLLSDHandlerResponse(); | 1034 | llsdResponse = GenerateNoLLSDHandlerResponse(); |
1003 | } | 1035 | } |
1004 | } | 1036 | } |
1005 | |||
1006 | } | 1037 | } |
1007 | else | 1038 | else |
1008 | { | 1039 | { |
1009 | llsdResponse = GenerateNoLLSDHandlerResponse(); | 1040 | llsdResponse = GenerateNoLLSDHandlerResponse(); |
1010 | } | 1041 | } |
1042 | |||
1011 | byte[] buffer = new byte[0]; | 1043 | byte[] buffer = new byte[0]; |
1044 | |||
1012 | if (llsdResponse.ToString() == "shutdown404!") | 1045 | if (llsdResponse.ToString() == "shutdown404!") |
1013 | { | 1046 | { |
1014 | response.ContentType = "text/plain"; | 1047 | response.ContentType = "text/plain"; |