diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 2f7b5499d2..28324a5ad6 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -833,7 +833,7 @@ namespace OpenSim.Framework.Servers.HttpServer 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); using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8)) @@ -978,6 +978,9 @@ namespace OpenSim.Framework.Servers.HttpServer { 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; StreamReader reader = new StreamReader(requestStream, encoding); diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index f36cbbc148..05ec6dc8c4 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs @@ -181,12 +181,23 @@ namespace OpenSim.Framework.Servers.HttpServer _request = req; _context = context; - if ((null != req.Headers["content-encoding"]) && ("gzip" != req.Headers["content-encoding"])) - _contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]); + if (null != req.Headers["content-encoding"]) + { + try + { + _contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]); + } + catch (Exception) + { + // ignore + } + } + if (null != req.Headers["content-type"]) _contentType = _request.Headers["content-type"]; if (null != req.Headers["user-agent"]) _userAgent = req.Headers["user-agent"]; + if (null != req.Headers["remote_addr"]) { try diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 3972c06a5c..eb3633a95a 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -254,7 +254,7 @@ namespace OpenSim.Framework 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()) { diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1254df4878..9c7f17e1b2 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -239,7 +239,7 @@ namespace OpenSim.Server.Handlers.Simulation } 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); StreamReader reader = new StreamReader(inputStream, encoding); @@ -433,7 +433,7 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("querystringkeys", querystringkeys); 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); Encoding encoding = Encoding.UTF8;