This makes compression of fatpacks actually work. Previously they always failed. See comment in WebUtil.
parent
9988bff9e3
commit
e9e4c009b4
|
@ -199,14 +199,14 @@ namespace OpenSim.Framework
|
||||||
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress))
|
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress))
|
||||||
{
|
{
|
||||||
comp.Write(buffer, 0, buffer.Length);
|
comp.Write(buffer, 0, buffer.Length);
|
||||||
comp.Flush();
|
// We need to close the gzip stream before we write it anywhere
|
||||||
|
// because apparently something important related to gzip compression
|
||||||
ms.Seek(0, SeekOrigin.Begin);
|
// gets written on the strteam upon Dispose()
|
||||||
|
|
||||||
request.ContentLength = ms.Length; //Count bytes to send
|
|
||||||
using (Stream requestStream = request.GetRequestStream())
|
|
||||||
requestStream.Write(ms.ToArray(), 0, (int)ms.Length);
|
|
||||||
}
|
}
|
||||||
|
byte[] buf = ms.ToArray();
|
||||||
|
request.ContentLength = buf.Length; //Count bytes to send
|
||||||
|
using (Stream requestStream = request.GetRequestStream())
|
||||||
|
requestStream.Write(buf, 0, (int)buf.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -283,6 +283,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
StreamReader reader = new StreamReader(inputStream, encoding);
|
StreamReader reader = new StreamReader(inputStream, encoding);
|
||||||
|
|
||||||
string requestBody = reader.ReadToEnd();
|
string requestBody = reader.ReadToEnd();
|
||||||
|
reader.Close();
|
||||||
keysvals.Add("body", requestBody);
|
keysvals.Add("body", requestBody);
|
||||||
|
|
||||||
httpResponse.StatusCode = 200;
|
httpResponse.StatusCode = 200;
|
||||||
|
@ -463,15 +464,13 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
if (httpRequest.ContentType == "application/x-gzip")
|
if (httpRequest.ContentType == "application/x-gzip")
|
||||||
inputStream = new GZipStream(request, CompressionMode.Decompress);
|
inputStream = new GZipStream(request, CompressionMode.Decompress);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_log.DebugFormat("[XXX]: Update called with {0}", httpRequest.ContentType);
|
|
||||||
inputStream = request;
|
inputStream = request;
|
||||||
}
|
|
||||||
|
|
||||||
Encoding encoding = Encoding.UTF8;
|
Encoding encoding = Encoding.UTF8;
|
||||||
StreamReader reader = new StreamReader(inputStream, encoding);
|
StreamReader reader = new StreamReader(inputStream, encoding);
|
||||||
|
|
||||||
string requestBody = reader.ReadToEnd();
|
string requestBody = reader.ReadToEnd();
|
||||||
|
reader.Close();
|
||||||
keysvals.Add("body", requestBody);
|
keysvals.Add("body", requestBody);
|
||||||
|
|
||||||
httpResponse.StatusCode = 200;
|
httpResponse.StatusCode = 200;
|
||||||
|
|
Loading…
Reference in New Issue