Commit 51e29b6c authored by Kent Friesen's avatar Kent Friesen

Forgot to add compression support for Brotli in last commit.

parent af09eb02
using System;
using System.IO;
using System.IO.Compression;
using Titanium.Web.Proxy.Helpers;
using Titanium.Web.Proxy.Http;
namespace Titanium.Web.Proxy.Compression
......@@ -18,6 +19,13 @@ namespace Titanium.Web.Proxy.Compression
return new GZipStream(stream, CompressionMode.Compress, leaveOpen);
case KnownHeaders.ContentEncodingDeflate:
return new DeflateStream(stream, CompressionMode.Compress, leaveOpen);
case KnownHeaders.ContentEncodingBrotli:
if (!RunTime.IsWindows)
{
throw new PlatformNotSupportedException("BrotliSharpLib currently supports only Windows.");
}
return new BrotliSharpLib.BrotliStream(stream, CompressionMode.Compress, leaveOpen);
default:
throw new Exception($"Unsupported compression mode: {type}");
}
......
using System;
using System.IO;
using System.IO.Compression;
using Titanium.Web.Proxy.Helpers;
using Titanium.Web.Proxy.Http;
namespace Titanium.Web.Proxy.Compression
......@@ -19,6 +20,11 @@ namespace Titanium.Web.Proxy.Compression
case KnownHeaders.ContentEncodingDeflate:
return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen);
case KnownHeaders.ContentEncodingBrotli:
if(!RunTime.IsWindows)
{
throw new PlatformNotSupportedException("BrotliSharpLib currently supports only Windows.");
}
return new BrotliSharpLib.BrotliStream(stream, CompressionMode.Decompress, leaveOpen);
default:
throw new Exception($"Unsupported decompression mode: {type}");
......
......@@ -13,7 +13,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.1" />
<PackageReference Include="CloudVeil.BrotliSharpLib" Version="0.3.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.2" />
<PackageReference Include="StreamExtended" Version="1.0.179" />
</ItemGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment