Closing more streams.

prioritization
Diva Canto 2009-10-03 08:33:19 -07:00
parent b4d1cf0009
commit 4843edfeb7
1 changed files with 27 additions and 4 deletions

View File

@ -66,8 +66,20 @@ namespace OpenSim.Framework.Servers.HttpServer
length = (int)obj.Length; length = (int)obj.Length;
request.ContentLength = length; request.ContentLength = length;
Stream requestStream = request.GetRequestStream(); Stream requestStream = null;
requestStream.Write(buffer.ToArray(), 0, length); try
{
requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length);
}
catch
{
}
finally
{
if (requestStream != null)
requestStream.Close();
}
} }
string respstring = String.Empty; string respstring = String.Empty;
@ -78,9 +90,20 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
if (resp.ContentLength > 0) if (resp.ContentLength > 0)
{ {
using (StreamReader reader = new StreamReader(resp.GetResponseStream())) Stream respStream = null;
try
{ {
respstring = reader.ReadToEnd(); respStream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(respStream))
{
respstring = reader.ReadToEnd();
}
}
catch { }
finally
{
if (respStream != null)
respStream.Close();
} }
} }
} }