authorgravatar for 9002722+cgbur@users.noreply.github.comChris Burgess <9002722+cgbur@users.noreply.github.com> 2023-09-26 17:16:40-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-09-26 17:16:40-04:00
log1c726bcb321d03ac74d1bd646b690991ba356fd8
tree21acaa9feaa3d57a969a80263feaf0cc77492536
parent5d907171e2941be9ad62e289ceeb17e7b4c0be2b
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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.

3 files changed, 3 insertions(+), 0 deletions(-)

lib/std/http.zig+1
......@@ -285,6 +285,7 @@ pub const TransferEncoding = enum {
285285};
286286
287287pub const ContentEncoding = enum {
288 identity,
288289 compress,
289290 deflate,
290291 gzip,
lib/std/http/Client.zig+1
......@@ -762,6 +762,7 @@ pub const Request = struct {
762762 req.response.skip = false;
763763 if (!req.response.parser.done) {
764764 if (req.response.transfer_compression) |tc| switch (tc) {
765 .identity => req.response.compression = .none,
765766 .compress => return error.CompressionNotSupported,
766767 .deflate => req.response.compression = .{
767768 .deflate = std.compress.zlib.decompressStream(req.client.allocator, req.transferReader()) catch return error.CompressionInitializationFailed,
lib/std/http/Server.zig+1
......@@ -528,6 +528,7 @@ pub const Response = struct {
528528
529529 if (!res.request.parser.done) {
530530 if (res.request.transfer_compression) |tc| switch (tc) {
531 .identity => res.request.compression = .none,
531532 .compress => return error.CompressionNotSupported,
532533 .deflate => res.request.compression = .{
533534 .deflate = std.compress.zlib.decompressStream(res.allocator, res.transferReader()) catch return error.CompressionInitializationFailed,