From b1d8aa0b6418a4edba8ce3b7b6f3db78616fd523 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 25 Mar 2014 16:20:21 +0200 Subject: Use the "Content-Encoding" header to indicate gzipped streams --- OpenSim/Framework/WebUtil.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/WebUtil.cs') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 10a2560..3972c06 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -250,9 +250,12 @@ namespace OpenSim.Framework byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); + request.ContentType = "application/json"; + if (compressed) { - request.ContentType = "application/x-gzip"; + request.Headers["Content-Encoding"] = "gzip"; + using (MemoryStream ms = new MemoryStream()) { using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) @@ -270,10 +273,9 @@ namespace OpenSim.Framework } else { - request.ContentType = "application/json"; request.ContentLength = buffer.Length; //Count bytes to send using (Stream requestStream = request.GetRequestStream()) - requestStream.Write(buffer, 0, buffer.Length); //Send it + requestStream.Write(buffer, 0, buffer.Length); //Send it } } -- cgit v1.1