aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/Client.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-02-15 10:55:40 -0800
committerGitHub <noreply@github.com>2024-02-15 10:55:40 -0800
commit57d6f789de1d5fed5006aa3cefeb5b005bbdf6d6 (patch)
tree5bf9efbcd7ad173d714bd549bae90af66761fb7b /lib/std/http/Client.zig
parent7204eccf5cbf32977b779181de871559b478511d (diff)
parent99cb201438e9458547082b35e1dd7c7c46c8c1bd (diff)
downloadzig-57d6f789de1d5fed5006aa3cefeb5b005bbdf6d6.tar.gz
zig-57d6f789de1d5fed5006aa3cefeb5b005bbdf6d6.zip
Merge pull request #18923 from ianic/add_flate
add deflate implemented from first principles
Diffstat (limited to 'lib/std/http/Client.zig')
-rw-r--r--lib/std/http/Client.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig
index ed6aec55aa..a50e814fd4 100644
--- a/lib/std/http/Client.zig
+++ b/lib/std/http/Client.zig
@@ -404,8 +404,8 @@ pub const RequestTransfer = union(enum) {
/// The decompressor for response messages.
pub const Compression = union(enum) {
- pub const DeflateDecompressor = std.compress.zlib.DecompressStream(Request.TransferReader);
- pub const GzipDecompressor = std.compress.gzip.Decompress(Request.TransferReader);
+ pub const DeflateDecompressor = std.compress.zlib.Decompressor(Request.TransferReader);
+ pub const GzipDecompressor = std.compress.gzip.Decompressor(Request.TransferReader);
pub const ZstdDecompressor = std.compress.zstd.DecompressStream(Request.TransferReader, .{});
deflate: DeflateDecompressor,
@@ -601,8 +601,8 @@ pub const Request = struct {
pub fn deinit(req: *Request) void {
switch (req.response.compression) {
.none => {},
- .deflate => |*deflate| deflate.deinit(),
- .gzip => |*gzip| gzip.deinit(),
+ .deflate => {},
+ .gzip => {},
.zstd => |*zstd| zstd.deinit(),
}
@@ -632,8 +632,8 @@ pub const Request = struct {
switch (req.response.compression) {
.none => {},
- .deflate => |*deflate| deflate.deinit(),
- .gzip => |*gzip| gzip.deinit(),
+ .deflate => {},
+ .gzip => {},
.zstd => |*zstd| zstd.deinit(),
}
@@ -941,10 +941,10 @@ pub const Request = struct {
.identity => req.response.compression = .none,
.compress, .@"x-compress" => return error.CompressionNotSupported,
.deflate => req.response.compression = .{
- .deflate = std.compress.zlib.decompressStream(req.client.allocator, req.transferReader()) catch return error.CompressionInitializationFailed,
+ .deflate = std.compress.zlib.decompressor(req.transferReader()),
},
.gzip, .@"x-gzip" => req.response.compression = .{
- .gzip = std.compress.gzip.decompress(req.client.allocator, req.transferReader()) catch return error.CompressionInitializationFailed,
+ .gzip = std.compress.gzip.decompressor(req.transferReader()),
},
.zstd => req.response.compression = .{
.zstd = std.compress.zstd.decompressStream(req.client.allocator, req.transferReader()),