Closing more streams.
parent
b4d1cf0009
commit
4843edfeb7
|
@ -66,8 +66,20 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
length = (int)obj.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
Stream requestStream = null;
|
||||
try
|
||||
{
|
||||
requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
string respstring = String.Empty;
|
||||
|
@ -78,9 +90,20 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue