diff options
author | Diva Canto | 2011-05-11 20:44:03 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-11 20:44:03 -0700 |
commit | e9e4c009b470056dce05cae386860494b0734678 (patch) | |
tree | 9c9ab809e48d1d22a945246b19b58024aabeb970 /OpenSim | |
parent | Add a smidgen of method doc about the fact that item links reuse the asset id... (diff) | |
download | opensim-SC-e9e4c009b470056dce05cae386860494b0734678.zip opensim-SC-e9e4c009b470056dce05cae386860494b0734678.tar.gz opensim-SC-e9e4c009b470056dce05cae386860494b0734678.tar.bz2 opensim-SC-e9e4c009b470056dce05cae386860494b0734678.tar.xz |
This makes compression of fatpacks actually work. Previously they always failed. See comment in WebUtil.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 14 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 5 |
2 files changed, 9 insertions, 10 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 55b38cd..bc2cd01 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -199,14 +199,14 @@ namespace OpenSim.Framework | |||
199 | using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) | 199 | using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) |
200 | { | 200 | { |
201 | comp.Write(buffer, 0, buffer.Length); | 201 | comp.Write(buffer, 0, buffer.Length); |
202 | comp.Flush(); | 202 | // We need to close the gzip stream before we write it anywhere |
203 | 203 | // because apparently something important related to gzip compression | |
204 | ms.Seek(0, SeekOrigin.Begin); | 204 | // gets written on the strteam upon Dispose() |
205 | |||
206 | request.ContentLength = ms.Length; //Count bytes to send | ||
207 | using (Stream requestStream = request.GetRequestStream()) | ||
208 | requestStream.Write(ms.ToArray(), 0, (int)ms.Length); | ||
209 | } | 205 | } |
206 | byte[] buf = ms.ToArray(); | ||
207 | request.ContentLength = buf.Length; //Count bytes to send | ||
208 | using (Stream requestStream = request.GetRequestStream()) | ||
209 | requestStream.Write(buf, 0, (int)buf.Length); | ||
210 | } | 210 | } |
211 | } | 211 | } |
212 | else | 212 | else |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ad74b9b..e8ae05b 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -283,6 +283,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
283 | StreamReader reader = new StreamReader(inputStream, encoding); | 283 | StreamReader reader = new StreamReader(inputStream, encoding); |
284 | 284 | ||
285 | string requestBody = reader.ReadToEnd(); | 285 | string requestBody = reader.ReadToEnd(); |
286 | reader.Close(); | ||
286 | keysvals.Add("body", requestBody); | 287 | keysvals.Add("body", requestBody); |
287 | 288 | ||
288 | httpResponse.StatusCode = 200; | 289 | httpResponse.StatusCode = 200; |
@@ -463,15 +464,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
463 | if (httpRequest.ContentType == "application/x-gzip") | 464 | if (httpRequest.ContentType == "application/x-gzip") |
464 | inputStream = new GZipStream(request, CompressionMode.Decompress); | 465 | inputStream = new GZipStream(request, CompressionMode.Decompress); |
465 | else | 466 | else |
466 | { | ||
467 | m_log.DebugFormat("[XXX]: Update called with {0}", httpRequest.ContentType); | ||
468 | inputStream = request; | 467 | inputStream = request; |
469 | } | ||
470 | 468 | ||
471 | Encoding encoding = Encoding.UTF8; | 469 | Encoding encoding = Encoding.UTF8; |
472 | StreamReader reader = new StreamReader(inputStream, encoding); | 470 | StreamReader reader = new StreamReader(inputStream, encoding); |
473 | 471 | ||
474 | string requestBody = reader.ReadToEnd(); | 472 | string requestBody = reader.ReadToEnd(); |
473 | reader.Close(); | ||
475 | keysvals.Add("body", requestBody); | 474 | keysvals.Add("body", requestBody); |
476 | 475 | ||
477 | httpResponse.StatusCode = 200; | 476 | httpResponse.StatusCode = 200; |