Fixed last-resort sending of error response (HTTP 500) when an error occurs while handling a request.

The previous code didn't actually send the response, so the caller was stuck until the timeout (100 seconds).
0.8.0.3
Oren Hurvitz 2014-04-01 15:00:22 +03:00
parent fad0fd7f75
commit bbfda8e19e
2 changed files with 10 additions and 10 deletions

View File

@ -492,8 +492,8 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
byte[] buffer500 = SendHTML500(response); byte[] buffer500 = SendHTML500(response);
response.Body.Write(buffer500,0,buffer500.Length); response.OutputStream.Write(buffer500, 0, buffer500.Length);
response.Body.Close(); response.Send();
} }
catch catch
{ {
@ -746,8 +746,8 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
byte[] buffer500 = SendHTML500(response); byte[] buffer500 = SendHTML500(response);
response.Body.Write(buffer500, 0, buffer500.Length); response.OutputStream.Write(buffer500, 0, buffer500.Length);
response.Body.Close(); response.Send();
} }
catch catch
{ {

View File

@ -1203,9 +1203,9 @@ namespace OpenSim.Framework
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
return deserial; return deserial;
else else
m_log.ErrorFormat( m_log.Error(string.Format(
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ",
verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); verb, requestUrl, typeof(TResponse).ToString()), e);
} }
} }
catch (System.InvalidOperationException) catch (System.InvalidOperationException)
@ -1217,9 +1217,9 @@ namespace OpenSim.Framework
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat( m_log.Debug(string.Format(
"[SynchronousRestObjectRequester]: Exception on response from {0} {1}: {2}{3}", "[SynchronousRestObjectRequester]: Exception on response from {0} {1} ",
verb, requestUrl, e.Message, e.StackTrace); verb, requestUrl), e);
} }
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);