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 | |
parent | Improved logging of HTTP requests (diff) | |
download | opensim-SC_OLD-f90aee696abe713d81c14035dabf987e1118e729.zip opensim-SC_OLD-f90aee696abe713d81c14035dabf987e1118e729.tar.gz opensim-SC_OLD-f90aee696abe713d81c14035dabf987e1118e729.tar.bz2 opensim-SC_OLD-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 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 29 |
2 files changed, 12 insertions, 21 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 19231e1..ea7f195 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -738,11 +738,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
738 | } | 738 | } |
739 | catch (IOException e) | 739 | catch (IOException e) |
740 | { | 740 | { |
741 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); | 741 | m_log.Error("[BASE HTTP SERVER]: HandleRequest() threw exception ", e); |
742 | } | 742 | } |
743 | catch (Exception e) | 743 | catch (Exception e) |
744 | { | 744 | { |
745 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); | 745 | m_log.Error("[BASE HTTP SERVER]: HandleRequest() threw exception ", e); |
746 | try | 746 | try |
747 | { | 747 | { |
748 | byte[] buffer500 = SendHTML500(response); | 748 | byte[] buffer500 = SendHTML500(response); |
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 | ||