diff options
Diffstat (limited to 'src/http_client_async.zig')
-rw-r--r-- | src/http_client_async.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index fe9d1e6c1..8a0e6548c 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1119,6 +1119,8 @@ pub const InternalState = struct { } fn decompressConst(this: *InternalState, buffer: []const u8, body_out_str: *MutableString) !void { + log("Decompressing {d} bytes\n", .{buffer.len}); + std.debug.assert(!body_out_str.owns(buffer)); defer this.compressed_body.reset(); var gzip_timer: std.time.Timer = undefined; @@ -1127,17 +1129,18 @@ pub const InternalState = struct { var reader: *Zlib.ZlibReaderArrayList = undefined; if (this.zlib_reader) |current_reader| { + std.debug.assert(current_reader.zlib.avail_in == 0); reader = current_reader; reader.zlib.next_in = buffer.ptr; reader.zlib.avail_in = @as(u32, @truncate(buffer.len)); - reader.list = body_out_str.list; const initial = body_out_str.list.items.len; body_out_str.list.expandToCapacity(); if (body_out_str.list.capacity == initial) { try body_out_str.list.ensureUnusedCapacity(body_out_str.allocator, 4096); body_out_str.list.expandToCapacity(); } + reader.list = body_out_str.list; reader.zlib.next_out = &body_out_str.list.items[initial]; reader.zlib.avail_out = @as(u32, @truncate(body_out_str.list.capacity - initial)); // we reset the total out so we can track how much we decompressed this time |