diff options
author | Melanie | 2012-09-24 20:14:00 +0100 |
---|---|---|
committer | Melanie | 2012-09-24 20:14:00 +0100 |
commit | bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6 (patch) | |
tree | 2ac67907f6333bbbc9e4d821c6607b53d0e22acb /OpenSim/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
parent | HG Rez object: warn the user if the item or asset cannot be found. (diff) | |
download | opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.zip opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.gz opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.bz2 opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AssetPermissions.cs | 84 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 230 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs | 22 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/MainServer.cs | 107 | ||||
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 81 |
6 files changed, 381 insertions, 151 deletions
diff --git a/OpenSim/Framework/AssetPermissions.cs b/OpenSim/Framework/AssetPermissions.cs new file mode 100644 index 0000000..4a905c2 --- /dev/null +++ b/OpenSim/Framework/AssetPermissions.cs | |||
@@ -0,0 +1,84 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | |||
5 | using Nini.Config; | ||
6 | using log4net; | ||
7 | |||
8 | using OpenMetaverse; | ||
9 | |||
10 | namespace OpenSim.Framework | ||
11 | { | ||
12 | public class AssetPermissions | ||
13 | { | ||
14 | private static readonly ILog m_log = | ||
15 | LogManager.GetLogger( | ||
16 | MethodBase.GetCurrentMethod().DeclaringType); | ||
17 | |||
18 | private bool[] m_DisallowExport, m_DisallowImport; | ||
19 | private string[] m_AssetTypeNames; | ||
20 | |||
21 | public AssetPermissions(IConfig config) | ||
22 | { | ||
23 | Type enumType = typeof(AssetType); | ||
24 | m_AssetTypeNames = Enum.GetNames(enumType); | ||
25 | for (int i = 0; i < m_AssetTypeNames.Length; i++) | ||
26 | m_AssetTypeNames[i] = m_AssetTypeNames[i].ToLower(); | ||
27 | int n = Enum.GetValues(enumType).Length; | ||
28 | m_DisallowExport = new bool[n]; | ||
29 | m_DisallowImport = new bool[n]; | ||
30 | |||
31 | LoadPermsFromConfig(config, "DisallowExport", m_DisallowExport); | ||
32 | LoadPermsFromConfig(config, "DisallowImport", m_DisallowImport); | ||
33 | |||
34 | } | ||
35 | |||
36 | private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray) | ||
37 | { | ||
38 | if (assetConfig == null) | ||
39 | return; | ||
40 | |||
41 | string perms = assetConfig.GetString(variable, String.Empty); | ||
42 | string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); | ||
43 | foreach (string s in parts) | ||
44 | { | ||
45 | int index = Array.IndexOf(m_AssetTypeNames, s.Trim().ToLower()); | ||
46 | if (index >= 0) | ||
47 | bitArray[index] = true; | ||
48 | else | ||
49 | m_log.WarnFormat("[Asset Permissions]: Invalid AssetType {0}", s); | ||
50 | } | ||
51 | |||
52 | } | ||
53 | |||
54 | public bool AllowedExport(sbyte type) | ||
55 | { | ||
56 | string assetTypeName = ((AssetType)type).ToString(); | ||
57 | |||
58 | int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower()); | ||
59 | if (index >= 0 && m_DisallowExport[index]) | ||
60 | { | ||
61 | m_log.DebugFormat("[Asset Permissions]: Export denied: configuration does not allow export of AssetType {0}", assetTypeName); | ||
62 | return false; | ||
63 | } | ||
64 | |||
65 | return true; | ||
66 | } | ||
67 | |||
68 | public bool AllowedImport(sbyte type) | ||
69 | { | ||
70 | string assetTypeName = ((AssetType)type).ToString(); | ||
71 | |||
72 | int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower()); | ||
73 | if (index >= 0 && m_DisallowImport[index]) | ||
74 | { | ||
75 | m_log.DebugFormat("[Asset Permissions]: Import denied: configuration does not allow import of AssetType {0}", assetTypeName); | ||
76 | return false; | ||
77 | } | ||
78 | |||
79 | return true; | ||
80 | } | ||
81 | |||
82 | |||
83 | } | ||
84 | } | ||
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index fc64ff9..e7bed6a 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -645,11 +645,11 @@ namespace OpenSim.Framework | |||
645 | 645 | ||
646 | #region Prim stuff | 646 | #region Prim stuff |
647 | 647 | ||
648 | m_nonphysPrimMin = config.GetFloat("NonphysicalPrimMin", 0); | 648 | m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); |
649 | allKeys.Remove("NonphysicalPrimMin"); | 649 | allKeys.Remove("NonPhysicalPrimMin"); |
650 | 650 | ||
651 | m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0); | 651 | m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0); |
652 | allKeys.Remove("NonphysicalPrimMax"); | 652 | allKeys.Remove("NonPhysicalPrimMax"); |
653 | 653 | ||
654 | m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0); | 654 | m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0); |
655 | allKeys.Remove("PhysicalPrimMin"); | 655 | allKeys.Remove("PhysicalPrimMin"); |
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()) |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 8094b6d..a03d626 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -54,9 +54,17 @@ namespace OpenSim.Framework | |||
54 | MethodBase.GetCurrentMethod().DeclaringType); | 54 | MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Control the printing of certain debug messages. | ||
58 | /// </summary> | ||
59 | /// <remarks> | ||
60 | /// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged. | ||
61 | /// </remarks> | ||
62 | public static int DebugLevel { get; set; } | ||
63 | |||
64 | /// <summary> | ||
57 | /// Request number for diagnostic purposes. | 65 | /// Request number for diagnostic purposes. |
58 | /// </summary> | 66 | /// </summary> |
59 | public static int RequestNumber = 0; | 67 | public static int RequestNumber { get; internal set; } |
60 | 68 | ||
61 | /// <summary> | 69 | /// <summary> |
62 | /// this is the header field used to communicate the local request id | 70 | /// this is the header field used to communicate the local request id |
@@ -146,7 +154,11 @@ namespace OpenSim.Framework | |||
146 | private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) | 154 | private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) |
147 | { | 155 | { |
148 | int reqnum = RequestNumber++; | 156 | int reqnum = RequestNumber++; |
149 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 157 | |
158 | if (DebugLevel >= 3) | ||
159 | m_log.DebugFormat( | ||
160 | "[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})", | ||
161 | reqnum, method, url, timeout, compressed); | ||
150 | 162 | ||
151 | string errorMessage = "unknown error"; | 163 | string errorMessage = "unknown error"; |
152 | int tickstart = Util.EnvironmentTickCount(); | 164 | int tickstart = Util.EnvironmentTickCount(); |
@@ -230,7 +242,7 @@ namespace OpenSim.Framework | |||
230 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 242 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
231 | if (tickdiff > LongCallTime) | 243 | if (tickdiff > LongCallTime) |
232 | m_log.InfoFormat( | 244 | m_log.InfoFormat( |
233 | "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | 245 | "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", |
234 | reqnum, | 246 | reqnum, |
235 | method, | 247 | method, |
236 | url, | 248 | url, |
@@ -239,10 +251,14 @@ namespace OpenSim.Framework | |||
239 | strBuffer != null | 251 | strBuffer != null |
240 | ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) | 252 | ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) |
241 | : ""); | 253 | : ""); |
254 | else if (DebugLevel >= 4) | ||
255 | m_log.DebugFormat( | ||
256 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | ||
257 | reqnum, tickdiff, tickdata); | ||
242 | } | 258 | } |
243 | 259 | ||
244 | m_log.DebugFormat( | 260 | m_log.DebugFormat( |
245 | "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); | 261 | "[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); |
246 | 262 | ||
247 | return ErrorResponseMap(errorMessage); | 263 | return ErrorResponseMap(errorMessage); |
248 | } | 264 | } |
@@ -318,7 +334,11 @@ namespace OpenSim.Framework | |||
318 | { | 334 | { |
319 | int reqnum = RequestNumber++; | 335 | int reqnum = RequestNumber++; |
320 | string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; | 336 | string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; |
321 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); | 337 | |
338 | if (DebugLevel >= 3) | ||
339 | m_log.DebugFormat( | ||
340 | "[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})", | ||
341 | reqnum, method, url, timeout); | ||
322 | 342 | ||
323 | string errorMessage = "unknown error"; | 343 | string errorMessage = "unknown error"; |
324 | int tickstart = Util.EnvironmentTickCount(); | 344 | int tickstart = Util.EnvironmentTickCount(); |
@@ -381,7 +401,7 @@ namespace OpenSim.Framework | |||
381 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 401 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
382 | if (tickdiff > LongCallTime) | 402 | if (tickdiff > LongCallTime) |
383 | m_log.InfoFormat( | 403 | m_log.InfoFormat( |
384 | "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | 404 | "[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", |
385 | reqnum, | 405 | reqnum, |
386 | method, | 406 | method, |
387 | url, | 407 | url, |
@@ -390,9 +410,13 @@ namespace OpenSim.Framework | |||
390 | queryString != null | 410 | queryString != null |
391 | ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString | 411 | ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString |
392 | : ""); | 412 | : ""); |
413 | else if (DebugLevel >= 4) | ||
414 | m_log.DebugFormat( | ||
415 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | ||
416 | reqnum, tickdiff, tickdata); | ||
393 | } | 417 | } |
394 | 418 | ||
395 | m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); | 419 | m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); |
396 | 420 | ||
397 | return ErrorResponseMap(errorMessage); | 421 | return ErrorResponseMap(errorMessage); |
398 | } | 422 | } |
@@ -644,7 +668,6 @@ namespace OpenSim.Framework | |||
644 | /// <returns></returns> | 668 | /// <returns></returns> |
645 | public static string[] GetPreferredImageTypes(string accept) | 669 | public static string[] GetPreferredImageTypes(string accept) |
646 | { | 670 | { |
647 | |||
648 | if (accept == null || accept == string.Empty) | 671 | if (accept == null || accept == string.Empty) |
649 | return new string[0]; | 672 | return new string[0]; |
650 | 673 | ||
@@ -703,13 +726,15 @@ namespace OpenSim.Framework | |||
703 | int maxConnections) | 726 | int maxConnections) |
704 | { | 727 | { |
705 | int reqnum = WebUtil.RequestNumber++; | 728 | int reqnum = WebUtil.RequestNumber++; |
706 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 729 | |
730 | if (WebUtil.DebugLevel >= 3) | ||
731 | m_log.DebugFormat( | ||
732 | "[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}", | ||
733 | reqnum, verb, requestUrl); | ||
707 | 734 | ||
708 | int tickstart = Util.EnvironmentTickCount(); | 735 | int tickstart = Util.EnvironmentTickCount(); |
709 | int tickdata = 0; | 736 | int tickdata = 0; |
710 | 737 | ||
711 | // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); | ||
712 | |||
713 | Type type = typeof(TRequest); | 738 | Type type = typeof(TRequest); |
714 | 739 | ||
715 | WebRequest request = WebRequest.Create(requestUrl); | 740 | WebRequest request = WebRequest.Create(requestUrl); |
@@ -866,7 +891,7 @@ namespace OpenSim.Framework | |||
866 | } | 891 | } |
867 | 892 | ||
868 | m_log.InfoFormat( | 893 | m_log.InfoFormat( |
869 | "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | 894 | "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", |
870 | reqnum, | 895 | reqnum, |
871 | verb, | 896 | verb, |
872 | requestUrl, | 897 | requestUrl, |
@@ -874,6 +899,12 @@ namespace OpenSim.Framework | |||
874 | tickdata, | 899 | tickdata, |
875 | originalRequest); | 900 | originalRequest); |
876 | } | 901 | } |
902 | else if (WebUtil.DebugLevel >= 4) | ||
903 | { | ||
904 | m_log.DebugFormat( | ||
905 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | ||
906 | reqnum, tickdiff, tickdata); | ||
907 | } | ||
877 | } | 908 | } |
878 | } | 909 | } |
879 | 910 | ||
@@ -894,7 +925,11 @@ namespace OpenSim.Framework | |||
894 | public static string MakeRequest(string verb, string requestUrl, string obj) | 925 | public static string MakeRequest(string verb, string requestUrl, string obj) |
895 | { | 926 | { |
896 | int reqnum = WebUtil.RequestNumber++; | 927 | int reqnum = WebUtil.RequestNumber++; |
897 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 928 | |
929 | if (WebUtil.DebugLevel >= 3) | ||
930 | m_log.DebugFormat( | ||
931 | "[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}", | ||
932 | reqnum, verb, requestUrl); | ||
898 | 933 | ||
899 | int tickstart = Util.EnvironmentTickCount(); | 934 | int tickstart = Util.EnvironmentTickCount(); |
900 | int tickdata = 0; | 935 | int tickdata = 0; |
@@ -979,13 +1014,17 @@ namespace OpenSim.Framework | |||
979 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 1014 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
980 | if (tickdiff > WebUtil.LongCallTime) | 1015 | if (tickdiff > WebUtil.LongCallTime) |
981 | m_log.InfoFormat( | 1016 | m_log.InfoFormat( |
982 | "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | 1017 | "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", |
983 | reqnum, | 1018 | reqnum, |
984 | verb, | 1019 | verb, |
985 | requestUrl, | 1020 | requestUrl, |
986 | tickdiff, | 1021 | tickdiff, |
987 | tickdata, | 1022 | tickdata, |
988 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1023 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1024 | else if (WebUtil.DebugLevel >= 4) | ||
1025 | m_log.DebugFormat( | ||
1026 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | ||
1027 | reqnum, tickdiff, tickdata); | ||
989 | 1028 | ||
990 | return respstring; | 1029 | return respstring; |
991 | } | 1030 | } |
@@ -1020,7 +1059,11 @@ namespace OpenSim.Framework | |||
1020 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) | 1059 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) |
1021 | { | 1060 | { |
1022 | int reqnum = WebUtil.RequestNumber++; | 1061 | int reqnum = WebUtil.RequestNumber++; |
1023 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 1062 | |
1063 | if (WebUtil.DebugLevel >= 3) | ||
1064 | m_log.DebugFormat( | ||
1065 | "[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}", | ||
1066 | reqnum, verb, requestUrl); | ||
1024 | 1067 | ||
1025 | int tickstart = Util.EnvironmentTickCount(); | 1068 | int tickstart = Util.EnvironmentTickCount(); |
1026 | int tickdata = 0; | 1069 | int tickdata = 0; |
@@ -1139,7 +1182,7 @@ namespace OpenSim.Framework | |||
1139 | } | 1182 | } |
1140 | 1183 | ||
1141 | m_log.InfoFormat( | 1184 | m_log.InfoFormat( |
1142 | "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | 1185 | "[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", |
1143 | reqnum, | 1186 | reqnum, |
1144 | verb, | 1187 | verb, |
1145 | requestUrl, | 1188 | requestUrl, |
@@ -1147,6 +1190,12 @@ namespace OpenSim.Framework | |||
1147 | tickdata, | 1190 | tickdata, |
1148 | originalRequest); | 1191 | originalRequest); |
1149 | } | 1192 | } |
1193 | else if (WebUtil.DebugLevel >= 4) | ||
1194 | { | ||
1195 | m_log.DebugFormat( | ||
1196 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | ||
1197 | reqnum, tickdiff, tickdata); | ||
1198 | } | ||
1150 | 1199 | ||
1151 | return deserial; | 1200 | return deserial; |
1152 | } | 1201 | } |