diff options
author | Oren Hurvitz | 2013-12-19 10:51:57 +0200 |
---|---|---|
committer | Oren Hurvitz | 2014-03-25 09:37:10 +0100 |
commit | f90aee696abe713d81c14035dabf987e1118e729 (patch) | |
tree | d1a26066acf93302e13597d6ff0bb42e997cfb03 /OpenSim/Framework/WebUtil.cs | |
parent | Improved logging of HTTP requests (diff) | |
download | opensim-SC-f90aee696abe713d81c14035dabf987e1118e729.zip opensim-SC-f90aee696abe713d81c14035dabf987e1118e729.tar.gz opensim-SC-f90aee696abe713d81c14035dabf987e1118e729.tar.bz2 opensim-SC-f90aee696abe713d81c14035dabf987e1118e729.tar.xz |
Always throw an exception if MakeRequest (used for HTTP POST) fails. (Previously many exceptions were ignored)
Resolves http://opensimulator.org/mantis/view.php?id=6949
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 7f341d2..10a2560 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -1024,8 +1024,9 @@ namespace OpenSim.Framework | |||
1024 | } | 1024 | } |
1025 | catch (Exception e) | 1025 | catch (Exception e) |
1026 | { | 1026 | { |
1027 | m_log.DebugFormat( | 1027 | m_log.ErrorFormat("[FORMS]: Error sending request to {0}: {1}. Request: {2}", requestUrl, e.Message, |
1028 | "[FORMS]: exception occured {0} {1}: {2}{3}", verb, requestUrl, e.Message, e.StackTrace); | 1028 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1029 | throw e; | ||
1029 | } | 1030 | } |
1030 | finally | 1031 | finally |
1031 | { | 1032 | { |
@@ -1043,27 +1044,17 @@ namespace OpenSim.Framework | |||
1043 | { | 1044 | { |
1044 | if (resp.ContentLength != 0) | 1045 | if (resp.ContentLength != 0) |
1045 | { | 1046 | { |
1046 | Stream respStream = null; | 1047 | using (Stream respStream = resp.GetResponseStream()) |
1047 | try | 1048 | using (StreamReader reader = new StreamReader(respStream)) |
1048 | { | 1049 | respstring = reader.ReadToEnd(); |
1049 | using (respStream = resp.GetResponseStream()) | ||
1050 | using (StreamReader reader = new StreamReader(respStream)) | ||
1051 | respstring = reader.ReadToEnd(); | ||
1052 | } | ||
1053 | catch (Exception e) | ||
1054 | { | ||
1055 | m_log.DebugFormat( | ||
1056 | "[FORMS]: Exception occured on receiving {0} {1}: {2}{3}", | ||
1057 | verb, requestUrl, e.Message, e.StackTrace); | ||
1058 | } | ||
1059 | } | 1050 | } |
1060 | } | 1051 | } |
1061 | } | 1052 | } |
1062 | catch (System.InvalidOperationException e) | 1053 | catch (Exception e) |
1063 | { | 1054 | { |
1064 | m_log.Debug( | 1055 | m_log.ErrorFormat("[FORMS]: Error receiving response from {0}: {1}. Request: {2}", requestUrl, e.Message, |
1065 | string.Format( | 1056 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1066 | "[FORMS]: InvalidOperationException on response from {0} {1} ", verb, requestUrl), e); | 1057 | throw e; |
1067 | } | 1058 | } |
1068 | } | 1059 | } |
1069 | 1060 | ||