std.http: fix the http.Client.wait() hanging when there is 1 more byte left

This commit is contained in:
Ed Yu 2023-06-22 17:44:53 -07:00 committed by Loris Cro
parent 30ea714274
commit 8dcb4a3dc4

View File

@ -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;