-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Net.Http
Milestone
Description
Background and motivation
DecompressionMethods auto-decoding was last expanded with Brotli. Since then, some web servers started serving content using ZSTD compression instead. As such, it'd be appropriate for .NET to include the ability to handle such encoding out of the box.
CURL supports this starting with version 7.72.0, released in August 2020.
Cloudflare supports this since last September.
API Proposal
namespace System.Net;
[Flags]
public enum DecompressionMethods
{
None = 0,
All = ~None
GZip = 0x1,
Deflate = 0x2,
Brotli = 0x4,
+ Zstandard = 0x8,
}API Usage
var handler = new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Zstandard
};Alternative Designs
Zstd instead of Zstandard?
The name used for encoding headers is zstd and the media type is application/zstd, while the proposed compression APIs are using Zstandard.
Similar with Brotli where br is used for headers, but we call the APIs Brotli.
Risks
Requires shipping Zstd in System.Compression.Native.
Copilot
Metadata
Metadata
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Net.Http