aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/Server.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/Server.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/Server.zig')
-rw-r--r--lib/std/http/Server.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig
index 48c4e2cbfb..4659041779 100644
--- a/lib/std/http/Server.zig
+++ b/lib/std/http/Server.zig
@@ -195,8 +195,8 @@ pub const ResponseTransfer = union(enum) {
/// The decompressor for request messages.
pub const Compression = union(enum) {
- pub const DeflateDecompressor = std.compress.zlib.DecompressStream(Response.TransferReader);
- pub const GzipDecompressor = std.compress.gzip.Decompress(Response.TransferReader);
+ pub const DeflateDecompressor = std.compress.zlib.Decompressor(Response.TransferReader);
+ pub const GzipDecompressor = std.compress.gzip.Decompressor(Response.TransferReader);
pub const ZstdDecompressor = std.compress.zstd.DecompressStream(Response.TransferReader, .{});
deflate: DeflateDecompressor,
@@ -420,8 +420,8 @@ pub const Response = struct {
switch (res.request.compression) {
.none => {},
- .deflate => |*deflate| deflate.deinit(),
- .gzip => |*gzip| gzip.deinit(),
+ .deflate => {},
+ .gzip => {},
.zstd => |*zstd| zstd.deinit(),
}
@@ -605,10 +605,10 @@ pub const Response = struct {
.identity => res.request.compression = .none,
.compress, .@"x-compress" => return error.CompressionNotSupported,
.deflate => res.request.compression = .{
- .deflate = std.compress.zlib.decompressStream(res.allocator, res.transferReader()) catch return error.CompressionInitializationFailed,
+ .deflate = std.compress.zlib.decompressor(res.transferReader()),
},
.gzip, .@"x-gzip" => res.request.compression = .{
- .gzip = std.compress.gzip.decompress(res.allocator, res.transferReader()) catch return error.CompressionInitializationFailed,
+ .gzip = std.compress.gzip.decompressor(res.transferReader()),
},
.zstd => res.request.compression = .{
.zstd = std.compress.zstd.decompressStream(res.allocator, res.transferReader()),