aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer
diff options
context:
space:
mode:
authorOren Hurvitz2014-03-25 19:09:03 +0200
committerOren Hurvitz2014-03-25 18:09:23 +0100
commit6d1d58b6549daea0183b70a1c702e3017abb9663 (patch)
tree3bd5ce0ff0f501dcccccc24915b7e00207563d47 /OpenSim/Framework/Servers/HttpServer
parentUse the "Content-Encoding" header to indicate gzipped streams (diff)
downloadopensim-SC_OLD-6d1d58b6549daea0183b70a1c702e3017abb9663.zip
opensim-SC_OLD-6d1d58b6549daea0183b70a1c702e3017abb9663.tar.gz
opensim-SC_OLD-6d1d58b6549daea0183b70a1c702e3017abb9663.tar.bz2
opensim-SC_OLD-6d1d58b6549daea0183b70a1c702e3017abb9663.tar.xz
Use the "X-Content-Encoding" header to indicate gzipped data, because old OpenSims fail if they get an unknown "Content-Encoding"
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs5
-rw-r--r--OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs15
2 files changed, 17 insertions, 3 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 2f7b549..28324a5 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -833,7 +833,7 @@ namespace OpenSim.Framework.Servers.HttpServer
833 833
834 Stream inputStream = Util.Copy(request.InputStream); 834 Stream inputStream = Util.Copy(request.InputStream);
835 835
836 if (request.Headers["Content-Encoding"] == "gzip") 836 if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
837 inputStream = new GZipStream(inputStream, System.IO.Compression.CompressionMode.Decompress); 837 inputStream = new GZipStream(inputStream, System.IO.Compression.CompressionMode.Decompress);
838 838
839 using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8)) 839 using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
@@ -978,6 +978,9 @@ namespace OpenSim.Framework.Servers.HttpServer
978 { 978 {
979 Stream requestStream = request.InputStream; 979 Stream requestStream = request.InputStream;
980 980
981 if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
982 requestStream = new GZipStream(requestStream, System.IO.Compression.CompressionMode.Decompress);
983
981 Encoding encoding = Encoding.UTF8; 984 Encoding encoding = Encoding.UTF8;
982 StreamReader reader = new StreamReader(requestStream, encoding); 985 StreamReader reader = new StreamReader(requestStream, encoding);
983 986
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs
index f36cbbc..05ec6dc 100644
--- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs
+++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs
@@ -181,12 +181,23 @@ namespace OpenSim.Framework.Servers.HttpServer
181 _request = req; 181 _request = req;
182 _context = context; 182 _context = context;
183 183
184 if ((null != req.Headers["content-encoding"]) && ("gzip" != req.Headers["content-encoding"])) 184 if (null != req.Headers["content-encoding"])
185 _contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]); 185 {
186 try
187 {
188 _contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]);
189 }
190 catch (Exception)
191 {
192 // ignore
193 }
194 }
195
186 if (null != req.Headers["content-type"]) 196 if (null != req.Headers["content-type"])
187 _contentType = _request.Headers["content-type"]; 197 _contentType = _request.Headers["content-type"];
188 if (null != req.Headers["user-agent"]) 198 if (null != req.Headers["user-agent"])
189 _userAgent = req.Headers["user-agent"]; 199 _userAgent = req.Headers["user-agent"];
200
190 if (null != req.Headers["remote_addr"]) 201 if (null != req.Headers["remote_addr"])
191 { 202 {
192 try 203 try