Repository navigation
Add BrotliDecompressionOptions to support Large Window Brotli decompression #135846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iremyux
wants to merge
13
commits into
dotnet:main
Choose a base branch
from
iremyux:133018-brotli-decomp-options
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+439
−1
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9de57da
Add BrotliDecompressionOptions for Large Window Brotli decompression
iremyux cc3c1ca
Merge branch 'dotnet:main' into 133018-brotli-decomp-options
iremyux a447b47
Change the return of declined data
iremyux abd7c44
Add tests
iremyux 3f30db1
Merge branch '133018-brotli-decomp-options' of https://github.com/ire…
iremyux 9b32609
Adding BrotliDecoderSetParameter native method
iremyux c1c8907
Revert all changes to encoder side
iremyux f71a6da
Review changes
iremyux 7f36c3d
Fix tests after encoder revert
iremyux 2691487
Removed EffectiveMaxWindowLog2
iremyux 5f954f5
Change exception type
iremyux 0eed1fd
Add WindowBits_DefaultLarge
iremyux ad0fa14
Extend large-window split-header test to verify resuming after NeedMo…
iremyux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/BrotliUtils.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ries/System.IO.Compression.Brotli/src/System/IO/Compression/dec/BrotliDecoderParameter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace System.IO.Compression | ||
| { | ||
| /// <summary> | ||
| /// DisableRingBufferReallocation - Disables the lazy growth of the ring buffer, so that the full window is allocated upfront. | ||
| /// LargeWindow - Flag that determines if "Large Window Brotli" is used, allowing window sizes up to 2^30 instead of the 2^24 maximum defined by RFC 7932. | ||
| /// </summary> | ||
| internal enum BrotliDecoderParameter | ||
| { | ||
| DisableRingBufferReallocation, | ||
| LargeWindow | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
.../System.IO.Compression.Brotli/src/System/IO/Compression/dec/BrotliDecompressionOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace System.IO.Compression | ||
| { | ||
| /// <summary> | ||
| /// Provides decompression options to be used with <see cref="BrotliStream"/>. | ||
| /// </summary> | ||
| public sealed class BrotliDecompressionOptions | ||
| { | ||
| private int _maxWindowLog2 = BrotliUtils.WindowBits_DefaultLarge; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum base-2 logarithm of the window size accepted when decompressing. | ||
| /// </summary> | ||
| /// <exception cref="ArgumentOutOfRangeException" accessor="set">The value is less than 10 or greater than 30.</exception> | ||
| /// <remarks> | ||
| /// A Brotli stream declares the window size it requires in its header; this property does not select a window size, it | ||
| /// rejects streams that ask for more than the specified value. Range is from 10 to 30. The default value is 24, the maximum | ||
| /// defined by RFC 7932. Values greater than 24 additionally enable the "Large Window Brotli" extension, which is not part of | ||
| /// RFC 7932. Because the decoder only allocates the memory a stream actually uses, raising this value does not by itself | ||
| /// increase memory consumption; it raises the upper bound of what a stream is permitted to request. | ||
| /// </remarks> | ||
| public int MaxWindowLog2 | ||
| { | ||
| get => _maxWindowLog2; | ||
| set | ||
| { | ||
| ArgumentOutOfRangeException.ThrowIfLessThan(value, BrotliUtils.WindowBits_Min, nameof(value)); | ||
| ArgumentOutOfRangeException.ThrowIfGreaterThan(value, BrotliUtils.WindowBits_MaxLarge, nameof(value)); | ||
|
|
||
| _maxWindowLog2 = value; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.