aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
authorteravus2012-11-15 10:05:16 -0500
committerteravus2012-11-15 10:05:16 -0500
commite9153e1d1aae50024d8cd05fe14a9bce34343a0e (patch)
treebc111d34f95a26b99c7e34d9e495dc14d1802cc3 /OpenSim/Framework/WebUtil.cs
parentMerge master into teravuswork (diff)
downloadopensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.zip
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.gz
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.bz2
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.xz
Revert "Merge master into teravuswork", it should have been avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/WebUtil.cs81
1 files changed, 16 insertions, 65 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index b85d93d..30a8c28 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -54,17 +54,9 @@ 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>
65 /// Request number for diagnostic purposes. 57 /// Request number for diagnostic purposes.
66 /// </summary> 58 /// </summary>
67 public static int RequestNumber { get; internal set; } 59 public static int RequestNumber = 0;
68 60
69 /// <summary> 61 /// <summary>
70 /// this is the header field used to communicate the local request id 62 /// this is the header field used to communicate the local request id
@@ -154,11 +146,7 @@ namespace OpenSim.Framework
154 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) 146 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
155 { 147 {
156 int reqnum = RequestNumber++; 148 int reqnum = RequestNumber++;
157 149 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
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);
162 150
163 string errorMessage = "unknown error"; 151 string errorMessage = "unknown error";
164 int tickstart = Util.EnvironmentTickCount(); 152 int tickstart = Util.EnvironmentTickCount();
@@ -242,7 +230,7 @@ namespace OpenSim.Framework
242 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 230 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
243 if (tickdiff > LongCallTime) 231 if (tickdiff > LongCallTime)
244 m_log.InfoFormat( 232 m_log.InfoFormat(
245 "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 233 "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
246 reqnum, 234 reqnum,
247 method, 235 method,
248 url, 236 url,
@@ -251,14 +239,10 @@ namespace OpenSim.Framework
251 strBuffer != null 239 strBuffer != null
252 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) 240 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
253 : ""); 241 : "");
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);
258 } 242 }
259 243
260 m_log.DebugFormat( 244 m_log.DebugFormat(
261 "[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); 245 "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
262 246
263 return ErrorResponseMap(errorMessage); 247 return ErrorResponseMap(errorMessage);
264 } 248 }
@@ -334,11 +318,7 @@ namespace OpenSim.Framework
334 { 318 {
335 int reqnum = RequestNumber++; 319 int reqnum = RequestNumber++;
336 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; 320 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
337 321 // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
338 if (DebugLevel >= 3)
339 m_log.DebugFormat(
340 "[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})",
341 reqnum, method, url, timeout);
342 322
343 string errorMessage = "unknown error"; 323 string errorMessage = "unknown error";
344 int tickstart = Util.EnvironmentTickCount(); 324 int tickstart = Util.EnvironmentTickCount();
@@ -401,7 +381,7 @@ namespace OpenSim.Framework
401 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 381 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
402 if (tickdiff > LongCallTime) 382 if (tickdiff > LongCallTime)
403 m_log.InfoFormat( 383 m_log.InfoFormat(
404 "[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 384 "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
405 reqnum, 385 reqnum,
406 method, 386 method,
407 url, 387 url,
@@ -410,13 +390,9 @@ namespace OpenSim.Framework
410 queryString != null 390 queryString != null
411 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString 391 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
412 : ""); 392 : "");
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);
417 } 393 }
418 394
419 m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); 395 m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
420 396
421 return ErrorResponseMap(errorMessage); 397 return ErrorResponseMap(errorMessage);
422 } 398 }
@@ -668,6 +644,7 @@ namespace OpenSim.Framework
668 /// <returns></returns> 644 /// <returns></returns>
669 public static string[] GetPreferredImageTypes(string accept) 645 public static string[] GetPreferredImageTypes(string accept)
670 { 646 {
647
671 if (accept == null || accept == string.Empty) 648 if (accept == null || accept == string.Empty)
672 return new string[0]; 649 return new string[0];
673 650
@@ -726,16 +703,14 @@ namespace OpenSim.Framework
726 int maxConnections) 703 int maxConnections)
727 { 704 {
728 int reqnum = WebUtil.RequestNumber++; 705 int reqnum = WebUtil.RequestNumber++;
729 706 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
730 if (WebUtil.DebugLevel >= 3)
731 m_log.DebugFormat(
732 "[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}",
733 reqnum, verb, requestUrl);
734 707
735 int tickstart = Util.EnvironmentTickCount(); 708 int tickstart = Util.EnvironmentTickCount();
736// int tickdata = 0; 709// int tickdata = 0;
737 int tickdiff = 0; 710 int tickdiff = 0;
738 711
712// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
713
739 Type type = typeof(TRequest); 714 Type type = typeof(TRequest);
740 715
741 WebRequest request = WebRequest.Create(requestUrl); 716 WebRequest request = WebRequest.Create(requestUrl);
@@ -893,7 +868,7 @@ namespace OpenSim.Framework
893 } 868 }
894 869
895 m_log.InfoFormat( 870 m_log.InfoFormat(
896 "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 871 "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
897 reqnum, 872 reqnum,
898 verb, 873 verb,
899 requestUrl, 874 requestUrl,
@@ -908,12 +883,6 @@ namespace OpenSim.Framework
908 requestUrl, 883 requestUrl,
909 tickdiff); 884 tickdiff);
910 } 885 }
911 else if (WebUtil.DebugLevel >= 4)
912 {
913 m_log.DebugFormat(
914 "[WEB UTIL]: HTTP OUT {0} took {1}ms",
915 reqnum, tickdiff);
916 }
917 } 886 }
918 } 887 }
919 888
@@ -934,11 +903,7 @@ namespace OpenSim.Framework
934 public static string MakeRequest(string verb, string requestUrl, string obj) 903 public static string MakeRequest(string verb, string requestUrl, string obj)
935 { 904 {
936 int reqnum = WebUtil.RequestNumber++; 905 int reqnum = WebUtil.RequestNumber++;
937 906 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
938 if (WebUtil.DebugLevel >= 3)
939 m_log.DebugFormat(
940 "[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}",
941 reqnum, verb, requestUrl);
942 907
943 int tickstart = Util.EnvironmentTickCount(); 908 int tickstart = Util.EnvironmentTickCount();
944 int tickdata = 0; 909 int tickdata = 0;
@@ -1025,7 +990,7 @@ namespace OpenSim.Framework
1025 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 990 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
1026 if (tickdiff > WebUtil.LongCallTime) 991 if (tickdiff > WebUtil.LongCallTime)
1027 m_log.InfoFormat( 992 m_log.InfoFormat(
1028 "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 993 "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}",
1029 reqnum, 994 reqnum,
1030 verb, 995 verb,
1031 requestUrl, 996 requestUrl,
@@ -1033,10 +998,6 @@ namespace OpenSim.Framework
1033 tickset, 998 tickset,
1034 tickdata, 999 tickdata,
1035 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1000 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1036 else if (WebUtil.DebugLevel >= 4)
1037 m_log.DebugFormat(
1038 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
1039 reqnum, tickdiff, tickdata);
1040 1001
1041 return respstring; 1002 return respstring;
1042 } 1003 }
@@ -1071,11 +1032,7 @@ namespace OpenSim.Framework
1071 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) 1032 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
1072 { 1033 {
1073 int reqnum = WebUtil.RequestNumber++; 1034 int reqnum = WebUtil.RequestNumber++;
1074 1035 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
1075 if (WebUtil.DebugLevel >= 3)
1076 m_log.DebugFormat(
1077 "[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}",
1078 reqnum, verb, requestUrl);
1079 1036
1080 int tickstart = Util.EnvironmentTickCount(); 1037 int tickstart = Util.EnvironmentTickCount();
1081 int tickdata = 0; 1038 int tickdata = 0;
@@ -1194,7 +1151,7 @@ namespace OpenSim.Framework
1194 } 1151 }
1195 1152
1196 m_log.InfoFormat( 1153 m_log.InfoFormat(
1197 "[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 1154 "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
1198 reqnum, 1155 reqnum,
1199 verb, 1156 verb,
1200 requestUrl, 1157 requestUrl,
@@ -1202,12 +1159,6 @@ namespace OpenSim.Framework
1202 tickdata, 1159 tickdata,
1203 originalRequest); 1160 originalRequest);
1204 } 1161 }
1205 else if (WebUtil.DebugLevel >= 4)
1206 {
1207 m_log.DebugFormat(
1208 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
1209 reqnum, tickdiff, tickdata);
1210 }
1211 1162
1212 return deserial; 1163 return deserial;
1213 } 1164 }