commit 8dcb4a3dc44fcc90b43543b9a0603456eeb4c348 (tree)
parent 30ea7142743efa385dc19e0746c04bf42331477c
Author: Ed Yu <edyu@users.noreply.github.com>
Date: Thu, 22 Jun 2023 17:44:53 -0700
std.http: fix the http.Client.wait() hanging when there is 1 more byte left
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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;