From 99ac770abbe3a95887c4b10c82f3985aa878eeef Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 1 Jun 2014 17:39:11 +0300 Subject: Close streams immediately when we finish using them --- OpenSim/Framework/WebUtil.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/WebUtil.cs') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index e614fd5..d683152 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -176,7 +176,8 @@ namespace OpenSim.Framework public static void LogOutgoingDetail(string context, Stream outputStream) { - using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8)) + using (Stream stream = Util.Copy(outputStream)) + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) { string output; @@ -262,12 +263,12 @@ namespace OpenSim.Framework using (MemoryStream ms = new MemoryStream()) { - using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) + using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress, true)) { comp.Write(buffer, 0, buffer.Length); // We need to close the gzip stream before we write it anywhere // because apparently something important related to gzip compression - // gets written on the strteam upon Dispose() + // gets written on the stream upon Dispose() } byte[] buf = ms.ToArray(); request.ContentLength = buf.Length; //Count bytes to send -- cgit v1.1