Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Titanium.Web.Proxy/Compression/CompressionFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.IO.Compression;
using Titanium.Web.Proxy.Helpers;
using Titanium.Web.Proxy.Http;

namespace Titanium.Web.Proxy.Compression
Expand All @@ -18,6 +19,8 @@ internal static Stream Create(string type, Stream stream, bool leaveOpen = true)
return new GZipStream(stream, CompressionMode.Compress, leaveOpen);
case KnownHeaders.ContentEncodingDeflate:
return new DeflateStream(stream, CompressionMode.Compress, leaveOpen);
case KnownHeaders.ContentEncodingBrotli:
return new BrotliSharpLib.BrotliStream(stream, CompressionMode.Compress, leaveOpen);
default:
throw new Exception($"Unsupported compression mode: {type}");
}
Expand Down
3 changes: 3 additions & 0 deletions src/Titanium.Web.Proxy/Compression/DecompressionFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.IO.Compression;
using Titanium.Web.Proxy.Helpers;
using Titanium.Web.Proxy.Http;

namespace Titanium.Web.Proxy.Compression
Expand All @@ -18,6 +19,8 @@ internal static Stream Create(string type, Stream stream, bool leaveOpen = true)
return new GZipStream(stream, CompressionMode.Decompress, leaveOpen);
case KnownHeaders.ContentEncodingDeflate:
return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen);
case KnownHeaders.ContentEncodingBrotli:
return new BrotliSharpLib.BrotliStream(stream, CompressionMode.Decompress, leaveOpen);
default:
throw new Exception($"Unsupported decompression mode: {type}");
}
Expand Down
1 change: 1 addition & 0 deletions src/Titanium.Web.Proxy/Http/KnownHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static class KnownHeaders
public const string ContentEncoding = "content-encoding";
public const string ContentEncodingDeflate = "deflate";
public const string ContentEncodingGzip = "gzip";
public const string ContentEncodingBrotli = "br";

public const string Location = "Location";

Expand Down
1 change: 1 addition & 0 deletions src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CloudVeil.BrotliSharpLib" Version="0.3.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.2" />
<PackageReference Include="StreamExtended" Version="1.0.179" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<dependencies>
<dependency id="StreamExtended" version="1.0.179" />
<dependency id="Portable.BouncyCastle" version="1.8.2" />
<dependency id="BrotliSharpLib" version="0.3.1" />
</dependencies>
</metadata>
<files>
Expand Down