Use the "X-Content-Encoding" header to indicate gzipped data, because old OpenSims fail if they get an unknown "Content-Encoding"
parent
b1d8aa0b64
commit
6d1d58b654
|
@ -833,7 +833,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
Stream inputStream = Util.Copy(request.InputStream);
|
Stream inputStream = Util.Copy(request.InputStream);
|
||||||
|
|
||||||
if (request.Headers["Content-Encoding"] == "gzip")
|
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
inputStream = new GZipStream(inputStream, System.IO.Compression.CompressionMode.Decompress);
|
inputStream = new GZipStream(inputStream, System.IO.Compression.CompressionMode.Decompress);
|
||||||
|
|
||||||
using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
|
using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
|
||||||
|
@ -978,6 +978,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
Stream requestStream = request.InputStream;
|
Stream requestStream = request.InputStream;
|
||||||
|
|
||||||
|
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
|
requestStream = new GZipStream(requestStream, System.IO.Compression.CompressionMode.Decompress);
|
||||||
|
|
||||||
Encoding encoding = Encoding.UTF8;
|
Encoding encoding = Encoding.UTF8;
|
||||||
StreamReader reader = new StreamReader(requestStream, encoding);
|
StreamReader reader = new StreamReader(requestStream, encoding);
|
||||||
|
|
||||||
|
|
|
@ -181,12 +181,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
_request = req;
|
_request = req;
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
||||||
if ((null != req.Headers["content-encoding"]) && ("gzip" != req.Headers["content-encoding"]))
|
if (null != req.Headers["content-encoding"])
|
||||||
_contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (null != req.Headers["content-type"])
|
if (null != req.Headers["content-type"])
|
||||||
_contentType = _request.Headers["content-type"];
|
_contentType = _request.Headers["content-type"];
|
||||||
if (null != req.Headers["user-agent"])
|
if (null != req.Headers["user-agent"])
|
||||||
_userAgent = req.Headers["user-agent"];
|
_userAgent = req.Headers["user-agent"];
|
||||||
|
|
||||||
if (null != req.Headers["remote_addr"])
|
if (null != req.Headers["remote_addr"])
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -254,7 +254,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
if (compressed)
|
if (compressed)
|
||||||
{
|
{
|
||||||
request.Headers["Content-Encoding"] = "gzip";
|
request.Headers["X-Content-Encoding"] = "gzip"; // can't set "Content-Encoding" because old OpenSims fail if they get an unrecognized Content-Encoding
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream inputStream = request;
|
Stream inputStream = request;
|
||||||
if (httpRequest.Headers["Content-Encoding"] == "gzip")
|
if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
||||||
|
|
||||||
StreamReader reader = new StreamReader(inputStream, encoding);
|
StreamReader reader = new StreamReader(inputStream, encoding);
|
||||||
|
@ -433,7 +433,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
keysvals.Add("querystringkeys", querystringkeys);
|
keysvals.Add("querystringkeys", querystringkeys);
|
||||||
|
|
||||||
Stream inputStream = request;
|
Stream inputStream = request;
|
||||||
if (httpRequest.Headers["Content-Encoding"] == "gzip")
|
if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
|
||||||
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
||||||
|
|
||||||
Encoding encoding = Encoding.UTF8;
|
Encoding encoding = Encoding.UTF8;
|
||||||
|
|
Loading…
Reference in New Issue