Quellcode durchsuchen

Remove Content-Encoding header after doing automatic decompression

Match the .NET Framework behaviour by removing the Content-Encoding
header after doing automatic decompression.
Filip Navara vor 8 Jahren
Ursprung
Commit
e6f020d390
1 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen
  1. 6 2
      mcs/class/System/System.Net/HttpWebResponse.cs

+ 6 - 2
mcs/class/System/System.Net/HttpWebResponse.cs

@@ -86,10 +86,14 @@ namespace System.Net
 			}
 
 			string content_encoding = webHeaders ["Content-Encoding"];
-			if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0)
+			if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
 				stream = new GZipStream (stream, CompressionMode.Decompress);
-			else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0)
+				webHeaders.Remove (HttpRequestHeader.ContentEncoding);
+			}
+			else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
 				stream = new DeflateStream (stream, CompressionMode.Decompress);
+				webHeaders.Remove (HttpRequestHeader.ContentEncoding);
+			}
 		}
 
 		[Obsolete ("Serialization is obsoleted for this type", false)]