diff options
author | Justin Clark-Casey (justincc) | 2012-06-14 23:46:09 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-14 23:46:09 +0100 |
commit | 9825861f4ac8d78665c33e2630824d97b356e642 (patch) | |
tree | 104fe5efe6f71cc002d25cfc2d3f641aee908d69 /OpenSim/Framework/Servers/HttpServer | |
parent | Fix a regression in BaseHttpServer.HandleXmlRpcRequests() from recent c6e3752 (diff) | |
download | opensim-SC_OLD-9825861f4ac8d78665c33e2630824d97b356e642.zip opensim-SC_OLD-9825861f4ac8d78665c33e2630824d97b356e642.tar.gz opensim-SC_OLD-9825861f4ac8d78665c33e2630824d97b356e642.tar.bz2 opensim-SC_OLD-9825861f4ac8d78665c33e2630824d97b356e642.tar.xz |
Shuffle "debug http" levels so that 1 and 2 now cause different levels of warn to be logged if we receive invalid xml for xmlrpc.
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 9064464..35a0be4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -82,6 +82,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
82 | /// <summary> | 82 | /// <summary> |
83 | /// Control the printing of certain debug messages. | 83 | /// Control the printing of certain debug messages. |
84 | /// </summary> | 84 | /// </summary> |
85 | /// <remarks> | ||
86 | /// If DebugLevel >= 1, then short warnings are logged when receiving bad input data. | ||
87 | /// If DebugLevel >= 2, then long warnings are logged when receiving bad input data. | ||
88 | /// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged. | ||
89 | /// </remarks> | ||
85 | public int DebugLevel { get; set; } | 90 | public int DebugLevel { get; set; } |
86 | 91 | ||
87 | public uint SSLPort | 92 | public uint SSLPort |
@@ -450,7 +455,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
450 | 455 | ||
451 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 456 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
452 | { | 457 | { |
453 | if (DebugLevel >= 1) | 458 | if (DebugLevel >= 3) |
454 | m_log.DebugFormat( | 459 | m_log.DebugFormat( |
455 | "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", | 460 | "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", |
456 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); | 461 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); |
@@ -531,7 +536,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
531 | case null: | 536 | case null: |
532 | case "text/html": | 537 | case "text/html": |
533 | 538 | ||
534 | if (DebugLevel >= 1) | 539 | if (DebugLevel >= 3) |
535 | m_log.DebugFormat( | 540 | m_log.DebugFormat( |
536 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 541 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", |
537 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 542 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
@@ -543,7 +548,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
543 | case "application/xml+llsd": | 548 | case "application/xml+llsd": |
544 | case "application/llsd+json": | 549 | case "application/llsd+json": |
545 | 550 | ||
546 | if (DebugLevel >= 1) | 551 | if (DebugLevel >= 3) |
547 | m_log.DebugFormat( | 552 | m_log.DebugFormat( |
548 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 553 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", |
549 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 554 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
@@ -564,7 +569,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
564 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); | 569 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler"); |
565 | if (DoWeHaveALLSDHandler(request.RawUrl)) | 570 | if (DoWeHaveALLSDHandler(request.RawUrl)) |
566 | { | 571 | { |
567 | if (DebugLevel >= 1) | 572 | if (DebugLevel >= 3) |
568 | m_log.DebugFormat( | 573 | m_log.DebugFormat( |
569 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 574 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", |
570 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 575 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
@@ -574,7 +579,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
574 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); | 579 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); |
575 | else if (DoWeHaveAHTTPHandler(request.RawUrl)) | 580 | else if (DoWeHaveAHTTPHandler(request.RawUrl)) |
576 | { | 581 | { |
577 | if (DebugLevel >= 1) | 582 | if (DebugLevel >= 3) |
578 | m_log.DebugFormat( | 583 | m_log.DebugFormat( |
579 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", | 584 | "[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}", |
580 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); | 585 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery); |
@@ -583,8 +588,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
583 | } | 588 | } |
584 | else | 589 | else |
585 | { | 590 | { |
586 | 591 | if (DebugLevel >= 3) | |
587 | if (DebugLevel >= 1) | ||
588 | m_log.DebugFormat( | 592 | m_log.DebugFormat( |
589 | "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", | 593 | "[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}", |
590 | request.HttpMethod, request.Url.PathAndQuery); | 594 | request.HttpMethod, request.Url.PathAndQuery); |
@@ -793,8 +797,23 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
793 | { | 797 | { |
794 | xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); | 798 | xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); |
795 | } | 799 | } |
796 | catch (XmlException) | 800 | catch (XmlException e) |
797 | { | 801 | { |
802 | if (DebugLevel >= 1) | ||
803 | { | ||
804 | if (DebugLevel >= 2) | ||
805 | m_log.Warn( | ||
806 | string.Format( | ||
807 | "[BASE HTTP SERVER]: Got XMLRPC request with invalid XML from {0}. XML was '{1}'. Sending blank response. Exception ", | ||
808 | request.RemoteIPEndPoint, requestBody), | ||
809 | e); | ||
810 | else | ||
811 | { | ||
812 | m_log.WarnFormat( | ||
813 | "[BASE HTTP SERVER]: Got XMLRPC request with invalid XML from {0}, length {1}. Sending blank response.", | ||
814 | request.RemoteIPEndPoint, requestBody.Length); | ||
815 | } | ||
816 | } | ||
798 | } | 817 | } |
799 | 818 | ||
800 | if (xmlRprcRequest != null) | 819 | if (xmlRprcRequest != null) |