cosmetics

master
UbitUmarov 2020-05-11 19:35:13 +01:00
parent 8da733c485
commit 4bf4c76a64
1 changed files with 19 additions and 21 deletions

View File

@ -404,25 +404,12 @@ namespace OpenSim.Framework
{ {
await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false); await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false);
} }
_response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false);
}
catch (WebException e)
{
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
RequestMethod, _request.RequestUri, e.Status, e.Message);
return;
}
catch (Exception e)
{
m_log.WarnFormat(
"[REST]: Request {0} {1} failed with exception {2} {3}",
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
return;
}
using(HttpWebResponse response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false))
{
if (WebUtil.DebugLevel >= 5) if (WebUtil.DebugLevel >= 5)
{ {
using (Stream responseStream = _response.GetResponseStream()) using (Stream responseStream = response.GetResponseStream())
{ {
using (StreamReader reader = new StreamReader(responseStream)) using (StreamReader reader = new StreamReader(responseStream))
{ {
@ -431,9 +418,20 @@ namespace OpenSim.Framework
} }
} }
} }
}
if (_response != null) }
_response.Close(); catch (WebException e)
{
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with status {1} and message {2}",
_request.RequestUri, e.Status, e.Message);
return;
}
catch (Exception e)
{
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with exception {1} {2}",
_request.RequestUri, e.Message, e.StackTrace);
return;
}
} }
#region Async Invocation #region Async Invocation