mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
std.http: add identity to content encodings (#16493)
Some servers will respond with the identity encoding, meaning no encoding, especially when responding to range-get requests. Adding the identity encoding stops the header parser from failing when it encounters this.
This commit is contained in:
parent
5d907171e2
commit
1c726bcb32
@ -285,6 +285,7 @@ pub const TransferEncoding = enum {
|
||||
};
|
||||
|
||||
pub const ContentEncoding = enum {
|
||||
identity,
|
||||
compress,
|
||||
deflate,
|
||||
gzip,
|
||||
|
||||
@ -762,6 +762,7 @@ pub const Request = struct {
|
||||
req.response.skip = false;
|
||||
if (!req.response.parser.done) {
|
||||
if (req.response.transfer_compression) |tc| switch (tc) {
|
||||
.identity => req.response.compression = .none,
|
||||
.compress => return error.CompressionNotSupported,
|
||||
.deflate => req.response.compression = .{
|
||||
.deflate = std.compress.zlib.decompressStream(req.client.allocator, req.transferReader()) catch return error.CompressionInitializationFailed,
|
||||
|
||||
@ -528,6 +528,7 @@ pub const Response = struct {
|
||||
|
||||
if (!res.request.parser.done) {
|
||||
if (res.request.transfer_compression) |tc| switch (tc) {
|
||||
.identity => res.request.compression = .none,
|
||||
.compress => return error.CompressionNotSupported,
|
||||
.deflate => res.request.compression = .{
|
||||
.deflate = std.compress.zlib.decompressStream(res.allocator, res.transferReader()) catch return error.CompressionInitializationFailed,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user