aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
authorOren Hurvitz2014-06-01 17:39:11 +0300
committerOren Hurvitz2014-07-21 08:30:03 +0100
commit99ac770abbe3a95887c4b10c82f3985aa878eeef (patch)
tree8c946dab083dd50a352f3861415eca43185d8d95 /OpenSim/Framework/WebUtil.cs
parentSet "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff)
downloadopensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.zip
opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.gz
opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.bz2
opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.xz
Close streams immediately when we finish using them
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/WebUtil.cs7
1 files changed, 4 insertions, 3 deletions
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
176 176
177 public static void LogOutgoingDetail(string context, Stream outputStream) 177 public static void LogOutgoingDetail(string context, Stream outputStream)
178 { 178 {
179 using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8)) 179 using (Stream stream = Util.Copy(outputStream))
180 using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
180 { 181 {
181 string output; 182 string output;
182 183
@@ -262,12 +263,12 @@ namespace OpenSim.Framework
262 263
263 using (MemoryStream ms = new MemoryStream()) 264 using (MemoryStream ms = new MemoryStream())
264 { 265 {
265 using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) 266 using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress, true))
266 { 267 {
267 comp.Write(buffer, 0, buffer.Length); 268 comp.Write(buffer, 0, buffer.Length);
268 // We need to close the gzip stream before we write it anywhere 269 // We need to close the gzip stream before we write it anywhere
269 // because apparently something important related to gzip compression 270 // because apparently something important related to gzip compression
270 // gets written on the strteam upon Dispose() 271 // gets written on the stream upon Dispose()
271 } 272 }
272 byte[] buf = ms.ToArray(); 273 byte[] buf = ms.ToArray();
273 request.ContentLength = buf.Length; //Count bytes to send 274 request.ContentLength = buf.Length; //Count bytes to send