aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/WebUtil.cs')
-rw-r--r--OpenSim/Framework/WebUtil.cs312
1 files changed, 224 insertions, 88 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index aac575c..6a40cd5 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -53,19 +53,36 @@ namespace OpenSim.Framework
53 LogManager.GetLogger( 53 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 54 MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private static int m_requestNumber = 0; 56 /// <summary>
57 /// Request number for diagnostic purposes.
58 /// </summary>
59 public static int RequestNumber = 0;
57 60
58 // this is the header field used to communicate the local request id 61 /// <summary>
59 // used for performance and debugging 62 /// this is the header field used to communicate the local request id
63 /// used for performance and debugging
64 /// </summary>
60 public const string OSHeaderRequestID = "opensim-request-id"; 65 public const string OSHeaderRequestID = "opensim-request-id";
61 66
62 // number of milliseconds a call can take before it is considered 67 /// <summary>
63 // a "long" call for warning & debugging purposes 68 /// Number of milliseconds a call can take before it is considered
64 public const int LongCallTime = 500; 69 /// a "long" call for warning & debugging purposes
70 /// </summary>
71 public const int LongCallTime = 3000;
65 72
66 // dictionary of end points 73 /// <summary>
74 /// The maximum length of any data logged because of a long request time.
75 /// </summary>
76 /// <remarks>
77 /// This is to truncate any really large post data, such as an asset. In theory, the first section should
78 /// give us useful information about the call (which agent it relates to if applicable, etc.).
79 /// </remarks>
80 public const int MaxRequestDiagLength = 100;
81
82 /// <summary>
83 /// Dictionary of end points
84 /// </summary>
67 private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>(); 85 private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>();
68
69 86
70 private static object EndPointLock(string url) 87 private static object EndPointLock(string url)
71 { 88 {
@@ -86,8 +103,7 @@ namespace OpenSim.Framework
86 return eplock; 103 return eplock;
87 } 104 }
88 } 105 }
89 106
90
91 #region JSONRequest 107 #region JSONRequest
92 108
93 /// <summary> 109 /// <summary>
@@ -129,12 +145,13 @@ namespace OpenSim.Framework
129 145
130 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)
131 { 147 {
132 int reqnum = m_requestNumber++; 148 int reqnum = RequestNumber++;
133 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 149 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
134 150
135 string errorMessage = "unknown error"; 151 string errorMessage = "unknown error";
136 int tickstart = Util.EnvironmentTickCount(); 152 int tickstart = Util.EnvironmentTickCount();
137 int tickdata = 0; 153 int tickdata = 0;
154 string strBuffer = null;
138 155
139 try 156 try
140 { 157 {
@@ -149,7 +166,7 @@ namespace OpenSim.Framework
149 // If there is some input, write it into the request 166 // If there is some input, write it into the request
150 if (data != null) 167 if (data != null)
151 { 168 {
152 string strBuffer = OSDParser.SerializeJsonString(data); 169 strBuffer = OSDParser.SerializeJsonString(data);
153 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); 170 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
154 171
155 if (compressed) 172 if (compressed)
@@ -210,14 +227,23 @@ namespace OpenSim.Framework
210 } 227 }
211 finally 228 finally
212 { 229 {
213 // This just dumps a warning for any operation that takes more than 100 ms
214 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 230 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
215 if (tickdiff > LongCallTime) 231 if (tickdiff > LongCallTime)
216 m_log.DebugFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", 232 m_log.InfoFormat(
217 reqnum,url,method,tickdiff,tickdata); 233 "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
234 reqnum,
235 method,
236 url,
237 tickdiff,
238 tickdata,
239 strBuffer != null
240 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
241 : "");
218 } 242 }
219 243
220 m_log.DebugFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); 244 m_log.DebugFormat(
245 "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
246
221 return ErrorResponseMap(errorMessage); 247 return ErrorResponseMap(errorMessage);
222 } 248 }
223 249
@@ -290,17 +316,17 @@ namespace OpenSim.Framework
290 316
291 private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) 317 private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout)
292 { 318 {
293 int reqnum = m_requestNumber++; 319 int reqnum = RequestNumber++;
294 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; 320 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
295 // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); 321 // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
296 322
297 string errorMessage = "unknown error"; 323 string errorMessage = "unknown error";
298 int tickstart = Util.EnvironmentTickCount(); 324 int tickstart = Util.EnvironmentTickCount();
299 int tickdata = 0; 325 int tickdata = 0;
326 string queryString = null;
300 327
301 try 328 try
302 { 329 {
303
304 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); 330 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
305 request.Method = "POST"; 331 request.Method = "POST";
306 request.Timeout = timeout; 332 request.Timeout = timeout;
@@ -311,7 +337,7 @@ namespace OpenSim.Framework
311 337
312 if (data != null) 338 if (data != null)
313 { 339 {
314 string queryString = BuildQueryString(data); 340 queryString = BuildQueryString(data);
315 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); 341 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
316 342
317 request.ContentLength = buffer.Length; 343 request.ContentLength = buffer.Length;
@@ -354,11 +380,20 @@ namespace OpenSim.Framework
354 { 380 {
355 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 381 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
356 if (tickdiff > LongCallTime) 382 if (tickdiff > LongCallTime)
357 m_log.InfoFormat("[WEB UTIL]: form request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", 383 m_log.InfoFormat(
358 reqnum,url,method,tickdiff,tickdata); 384 "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
385 reqnum,
386 method,
387 url,
388 tickdiff,
389 tickdata,
390 queryString != null
391 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
392 : "");
359 } 393 }
360 394
361 m_log.WarnFormat("[WEB UTIL]: <{0}> form request failed: {1}",reqnum,errorMessage); 395 m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
396
362 return ErrorResponseMap(errorMessage); 397 return ErrorResponseMap(errorMessage);
363 } 398 }
364 399
@@ -638,8 +673,6 @@ namespace OpenSim.Framework
638 673
639 return new string[0]; 674 return new string[0];
640 } 675 }
641
642
643 } 676 }
644 677
645 public static class AsynchronousRestObjectRequester 678 public static class AsynchronousRestObjectRequester
@@ -662,6 +695,12 @@ namespace OpenSim.Framework
662 public static void MakeRequest<TRequest, TResponse>(string verb, 695 public static void MakeRequest<TRequest, TResponse>(string verb,
663 string requestUrl, TRequest obj, Action<TResponse> action) 696 string requestUrl, TRequest obj, Action<TResponse> action)
664 { 697 {
698 int reqnum = WebUtil.RequestNumber++;
699 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
700
701 int tickstart = Util.EnvironmentTickCount();
702 int tickdata = 0;
703
665 // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); 704 // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
666 705
667 Type type = typeof(TRequest); 706 Type type = typeof(TRequest);
@@ -672,12 +711,13 @@ namespace OpenSim.Framework
672 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 711 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
673 712
674 request.Method = verb; 713 request.Method = verb;
714 MemoryStream buffer = null;
675 715
676 if (verb == "POST") 716 if (verb == "POST")
677 { 717 {
678 request.ContentType = "text/xml"; 718 request.ContentType = "text/xml";
679 719
680 MemoryStream buffer = new MemoryStream(); 720 buffer = new MemoryStream();
681 721
682 XmlWriterSettings settings = new XmlWriterSettings(); 722 XmlWriterSettings settings = new XmlWriterSettings();
683 settings.Encoding = Encoding.UTF8; 723 settings.Encoding = Encoding.UTF8;
@@ -699,6 +739,9 @@ namespace OpenSim.Framework
699 requestStream.Write(buffer.ToArray(), 0, length); 739 requestStream.Write(buffer.ToArray(), 0, length);
700 requestStream.Close(); 740 requestStream.Close();
701 741
742 // capture how much time was spent writing
743 tickdata = Util.EnvironmentTickCountSubtract(tickstart);
744
702 request.BeginGetResponse(delegate(IAsyncResult ar) 745 request.BeginGetResponse(delegate(IAsyncResult ar)
703 { 746 {
704 response = request.EndGetResponse(ar); 747 response = request.EndGetResponse(ar);
@@ -724,83 +767,108 @@ namespace OpenSim.Framework
724 767
725 }, null); 768 }, null);
726 }, null); 769 }, null);
727
728
729 return;
730 } 770 }
731 771 else
732 request.BeginGetResponse(delegate(IAsyncResult res2)
733 { 772 {
734 try 773 request.BeginGetResponse(delegate(IAsyncResult res2)
735 { 774 {
736 // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
737 // documented in MSDN
738 response = request.EndGetResponse(res2);
739
740 Stream respStream = null;
741 try 775 try
742 { 776 {
743 respStream = response.GetResponseStream(); 777 // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
744 deserial = (TResponse)deserializer.Deserialize(respStream); 778 // documented in MSDN
745 } 779 response = request.EndGetResponse(res2);
746 catch (System.InvalidOperationException) 780
747 { 781 Stream respStream = null;
748 } 782 try
749 finally 783 {
750 { 784 respStream = response.GetResponseStream();
751 respStream.Close(); 785 deserial = (TResponse)deserializer.Deserialize(respStream);
752 response.Close(); 786 }
787 catch (System.InvalidOperationException)
788 {
789 }
790 finally
791 {
792 respStream.Close();
793 response.Close();
794 }
753 } 795 }
754 } 796 catch (WebException e)
755 catch (WebException e)
756 {
757 if (e.Status == WebExceptionStatus.ProtocolError)
758 { 797 {
759 if (e.Response is HttpWebResponse) 798 if (e.Status == WebExceptionStatus.ProtocolError)
760 { 799 {
761 HttpWebResponse httpResponse = (HttpWebResponse)e.Response; 800 if (e.Response is HttpWebResponse)
762
763 if (httpResponse.StatusCode != HttpStatusCode.NotFound)
764 { 801 {
765 // We don't appear to be handling any other status codes, so log these feailures to that 802 HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
766 // people don't spend unnecessary hours hunting phantom bugs. 803
767 m_log.DebugFormat( 804 if (httpResponse.StatusCode != HttpStatusCode.NotFound)
768 "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", 805 {
769 verb, requestUrl, httpResponse.StatusCode); 806 // We don't appear to be handling any other status codes, so log these feailures to that
807 // people don't spend unnecessary hours hunting phantom bugs.
808 m_log.DebugFormat(
809 "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
810 verb, requestUrl, httpResponse.StatusCode);
811 }
770 } 812 }
771 } 813 }
814 else
815 {
816 m_log.ErrorFormat(
817 "[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}",
818 verb, requestUrl, e.Status, e.Message);
819 }
772 } 820 }
773 else 821 catch (Exception e)
774 { 822 {
775 m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message); 823 m_log.ErrorFormat(
824 "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}",
825 verb, requestUrl, e.Message, e.StackTrace);
776 } 826 }
777 } 827
778 catch (Exception e) 828 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
779 {
780 m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
781 }
782 829
783 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); 830 try
831 {
832 action(deserial);
833 }
834 catch (Exception e)
835 {
836 m_log.ErrorFormat(
837 "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}",
838 verb, requestUrl, e.Message, e.StackTrace);
839 }
840
841 }, null);
842 }
784 843
785 try 844 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
786 { 845 if (tickdiff > WebUtil.LongCallTime)
787 action(deserial); 846 {
788 } 847 string originalRequest = null;
789 catch (Exception e) 848
849 if (buffer != null)
790 { 850 {
791 m_log.ErrorFormat( 851 originalRequest = Encoding.UTF8.GetString(buffer.ToArray());
792 "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); 852
853 if (originalRequest.Length > WebUtil.MaxRequestDiagLength)
854 originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength);
793 } 855 }
794 856
795 }, null); 857 m_log.InfoFormat(
858 "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
859 reqnum,
860 verb,
861 requestUrl,
862 tickdiff,
863 tickdata,
864 originalRequest);
865 }
796 } 866 }
797 } 867 }
798 868
799 public static class SynchronousRestFormsRequester 869 public static class SynchronousRestFormsRequester
800 { 870 {
801 private static readonly ILog m_log = 871 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
802 LogManager.GetLogger(
803 MethodBase.GetCurrentMethod().DeclaringType);
804 872
805 /// <summary> 873 /// <summary>
806 /// Perform a synchronous REST request. 874 /// Perform a synchronous REST request.
@@ -814,6 +882,12 @@ namespace OpenSim.Framework
814 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> 882 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
815 public static string MakeRequest(string verb, string requestUrl, string obj) 883 public static string MakeRequest(string verb, string requestUrl, string obj)
816 { 884 {
885 int reqnum = WebUtil.RequestNumber++;
886 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
887
888 int tickstart = Util.EnvironmentTickCount();
889 int tickdata = 0;
890
817 WebRequest request = WebRequest.Create(requestUrl); 891 WebRequest request = WebRequest.Create(requestUrl);
818 request.Method = verb; 892 request.Method = verb;
819 string respstring = String.Empty; 893 string respstring = String.Empty;
@@ -842,12 +916,16 @@ namespace OpenSim.Framework
842 } 916 }
843 catch (Exception e) 917 catch (Exception e)
844 { 918 {
845 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); 919 m_log.DebugFormat(
920 "[FORMS]: exception occured {0} {1}: {2}{3}", verb, requestUrl, e.Message, e.StackTrace);
846 } 921 }
847 finally 922 finally
848 { 923 {
849 if (requestStream != null) 924 if (requestStream != null)
850 requestStream.Close(); 925 requestStream.Close();
926
927 // capture how much time was spent writing
928 tickdata = Util.EnvironmentTickCountSubtract(tickstart);
851 } 929 }
852 } 930 }
853 931
@@ -868,7 +946,9 @@ namespace OpenSim.Framework
868 } 946 }
869 catch (Exception e) 947 catch (Exception e)
870 { 948 {
871 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); 949 m_log.DebugFormat(
950 "[FORMS]: Exception occured on receiving {0} {1}: {2}{3}",
951 verb, requestUrl, e.Message, e.StackTrace);
872 } 952 }
873 finally 953 finally
874 { 954 {
@@ -881,9 +961,21 @@ namespace OpenSim.Framework
881 catch (System.InvalidOperationException) 961 catch (System.InvalidOperationException)
882 { 962 {
883 // This is what happens when there is invalid XML 963 // This is what happens when there is invalid XML
884 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); 964 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving {0} {1}", verb, requestUrl);
885 } 965 }
886 } 966 }
967
968 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
969 if (tickdiff > WebUtil.LongCallTime)
970 m_log.InfoFormat(
971 "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
972 reqnum,
973 verb,
974 requestUrl,
975 tickdiff,
976 tickdata,
977 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
978
887 return respstring; 979 return respstring;
888 } 980 }
889 } 981 }
@@ -911,6 +1003,12 @@ namespace OpenSim.Framework
911 1003
912 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) 1004 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
913 { 1005 {
1006 int reqnum = WebUtil.RequestNumber++;
1007 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
1008
1009 int tickstart = Util.EnvironmentTickCount();
1010 int tickdata = 0;
1011
914 Type type = typeof(TRequest); 1012 Type type = typeof(TRequest);
915 TResponse deserial = default(TResponse); 1013 TResponse deserial = default(TResponse);
916 1014
@@ -918,12 +1016,13 @@ namespace OpenSim.Framework
918 request.Method = verb; 1016 request.Method = verb;
919 if (pTimeout != 0) 1017 if (pTimeout != 0)
920 request.Timeout = pTimeout * 1000; 1018 request.Timeout = pTimeout * 1000;
1019 MemoryStream buffer = null;
921 1020
922 if ((verb == "POST") || (verb == "PUT")) 1021 if ((verb == "POST") || (verb == "PUT"))
923 { 1022 {
924 request.ContentType = "text/xml"; 1023 request.ContentType = "text/xml";
925 1024
926 MemoryStream buffer = new MemoryStream(); 1025 buffer = new MemoryStream();
927 1026
928 XmlWriterSettings settings = new XmlWriterSettings(); 1027 XmlWriterSettings settings = new XmlWriterSettings();
929 settings.Encoding = Encoding.UTF8; 1028 settings.Encoding = Encoding.UTF8;
@@ -946,13 +1045,19 @@ namespace OpenSim.Framework
946 } 1045 }
947 catch (Exception e) 1046 catch (Exception e)
948 { 1047 {
949 m_log.DebugFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e); 1048 m_log.DebugFormat(
1049 "[SynchronousRestObjectRequester]: Exception in making request {0} {1}: {2}{3}",
1050 verb, requestUrl, e.Message, e.StackTrace);
1051
950 return deserial; 1052 return deserial;
951 } 1053 }
952 finally 1054 finally
953 { 1055 {
954 if (requestStream != null) 1056 if (requestStream != null)
955 requestStream.Close(); 1057 requestStream.Close();
1058
1059 // capture how much time was spent writing
1060 tickdata = Util.EnvironmentTickCountSubtract(tickstart);
956 } 1061 }
957 } 1062 }
958 1063
@@ -968,7 +1073,11 @@ namespace OpenSim.Framework
968 respStream.Close(); 1073 respStream.Close();
969 } 1074 }
970 else 1075 else
971 m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); 1076 {
1077 m_log.DebugFormat(
1078 "[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}",
1079 verb, requestUrl);
1080 }
972 } 1081 }
973 } 1082 }
974 catch (WebException e) 1083 catch (WebException e)
@@ -979,17 +1088,44 @@ namespace OpenSim.Framework
979 return deserial; 1088 return deserial;
980 else 1089 else
981 m_log.ErrorFormat( 1090 m_log.ErrorFormat(
982 "[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}", 1091 "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}",
983 requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); 1092 verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
984 } 1093 }
985 catch (System.InvalidOperationException) 1094 catch (System.InvalidOperationException)
986 { 1095 {
987 // This is what happens when there is invalid XML 1096 // This is what happens when there is invalid XML
988 m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString()); 1097 m_log.DebugFormat(
1098 "[SynchronousRestObjectRequester]: Invalid XML from {0} {1} {2}",
1099 verb, requestUrl, typeof(TResponse).ToString());
989 } 1100 }
990 catch (Exception e) 1101 catch (Exception e)
991 { 1102 {
992 m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e); 1103 m_log.DebugFormat(
1104 "[SynchronousRestObjectRequester]: Exception on response from {0} {1}: {2}{3}",
1105 verb, requestUrl, e.Message, e.StackTrace);
1106 }
1107
1108 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
1109 if (tickdiff > WebUtil.LongCallTime)
1110 {
1111 string originalRequest = null;
1112
1113 if (buffer != null)
1114 {
1115 originalRequest = Encoding.UTF8.GetString(buffer.ToArray());
1116
1117 if (originalRequest.Length > WebUtil.MaxRequestDiagLength)
1118 originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength);
1119 }
1120
1121 m_log.InfoFormat(
1122 "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
1123 reqnum,
1124 verb,
1125 requestUrl,
1126 tickdiff,
1127 tickdata,
1128 originalRequest);
993 } 1129 }
994 1130
995 return deserial; 1131 return deserial;