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,9 +66,21 @@ 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;
try
{
requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length); requestStream.Write(buffer.ToArray(), 0, length);
} }
catch
{
}
finally
{
if (requestStream != null)
requestStream.Close();
}
}
string respstring = String.Empty; string respstring = String.Empty;
@ -78,11 +90,22 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
if (resp.ContentLength > 0) if (resp.ContentLength > 0)
{ {
using (StreamReader reader = new StreamReader(resp.GetResponseStream())) Stream respStream = null;
try
{
respStream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(respStream))
{ {
respstring = reader.ReadToEnd(); respstring = reader.ReadToEnd();
} }
} }
catch { }
finally
{
if (respStream != null)
respStream.Close();
}
}
} }
} }
catch (System.InvalidOperationException) catch (System.InvalidOperationException)