From 99111e50520860477a84620b3033b4d5d6a2c750 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 23:51:13 +0100 Subject: [PATCH] enclose GetRequestStream on try/catch --- OpenSim/Framework/RestClient.cs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index 0166d9d37e..ac394fb735 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -428,22 +428,23 @@ namespace OpenSim.Framework if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); - using (Stream dst = _request.GetRequestStream()) - { - m_log.Debug("[REST]: GetRequestStream is ok"); - - byte[] buf = new byte[1024]; - int length = src.Read(buf, 0, 1024); - m_log.Debug("[REST]: First Read is ok"); - while (length > 0) - { - dst.Write(buf, 0, length); - length = src.Read(buf, 0, 1024); - } - } - + try { + using (Stream dst = _request.GetRequestStream()) + { + m_log.Debug("[REST]: GetRequestStream is ok"); + + byte[] buf = new byte[1024]; + int length = src.Read(buf, 0, 1024); + m_log.Debug("[REST]: First Read is ok"); + while (length > 0) + { + dst.Write(buf, 0, length); + length = src.Read(buf, 0, 1024); + } + } + _response = (HttpWebResponse)_request.GetResponse(); } catch (WebException e)