ブラウザがgzipを受け入れるときに圧縮されたデータを転送するように、メソッドを調整したいだけです。そのelse
部分はすでに機能しています。パーツを調整したいだけですif
。コードは次のとおりです。
private void writeBytes()
{
var response = this.context.Response;
if (canGzip)
{
response.AppendHeader("Content-Encoding", "gzip");
//COMPRESS WITH GZipStream
}
else
{
response.AppendHeader("Content-Length", this.responseBytes.Length.ToString());
response.ContentType = this.isScript ? "text/javascript" : "text/css";
response.AppendHeader("Content-Encoding", "utf-8");
response.ContentEncoding = Encoding.Unicode;
response.OutputStream.Write(this.responseBytes, 0, this.responseBytes.Length);
response.Flush();
}
}