From 8dcb4a3dc44fcc90b43543b9a0603456eeb4c348 Mon Sep 17 00:00:00 2001 From: Ed Yu Date: Thu, 22 Jun 2023 17:44:53 -0700 Subject: [PATCH] std.http: fix the http.Client.wait() hanging when there is 1 more byte left --- lib/std/http/protocol.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/http/protocol.zig b/lib/std/http/protocol.zig index b5c2cdfa0c..6bafb08483 100644 --- a/lib/std/http/protocol.zig +++ b/lib/std/http/protocol.zig @@ -581,7 +581,7 @@ pub const HeadersParser = struct { const nread = @min(conn.peek().len, data_avail); conn.drop(@intCast(u16, nread)); r.next_chunk_length -= nread; - } else { + } else if (out_avail > 0) { const can_read = @intCast(usize, @min(data_avail, out_avail)); const nread = try conn.read(buffer[out_index..][0..can_read]); r.next_chunk_length -= nread;