Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit af09eb0

Browse files
committed
Adds brotli compression support to the proxy.
1 parent bf98361 commit af09eb0

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

src/Titanium.Web.Proxy/Compression/DecompressionFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ internal static Stream Create(string type, Stream stream, bool leaveOpen = true)
1818
return new GZipStream(stream, CompressionMode.Decompress, leaveOpen);
1919
case KnownHeaders.ContentEncodingDeflate:
2020
return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen);
21+
case KnownHeaders.ContentEncodingBrotli:
22+
return new BrotliSharpLib.BrotliStream(stream, CompressionMode.Decompress, leaveOpen);
2123
default:
2224
throw new Exception($"Unsupported decompression mode: {type}");
2325
}

src/Titanium.Web.Proxy/Http/KnownHeaders.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static class KnownHeaders
3939
public const string ContentEncoding = "content-encoding";
4040
public const string ContentEncodingDeflate = "deflate";
4141
public const string ContentEncodingGzip = "gzip";
42+
public const string ContentEncodingBrotli = "br";
4243

4344
public const string Location = "Location";
4445

src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16+
<PackageReference Include="BrotliSharpLib" Version="0.3.1" />
1617
<PackageReference Include="Portable.BouncyCastle" Version="1.8.2" />
1718
<PackageReference Include="StreamExtended" Version="1.0.179" />
1819
</ItemGroup>

src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<dependencies>
1717
<dependency id="StreamExtended" version="1.0.179" />
1818
<dependency id="Portable.BouncyCastle" version="1.8.2" />
19+
<dependency id="BrotliSharpLib" version="0.3.1" />
1920
</dependencies>
2021
</metadata>
2122
<files>

0 commit comments

Comments
 (0)