Skip to content

Commit 8dcb4a3

Browse files
edyukristoff-it
authored andcommitted
std.http: fix the http.Client.wait() hanging when there is 1 more byte left
1 parent 30ea714 commit 8dcb4a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/http/protocol.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ pub const HeadersParser = struct {
581581
const nread = @min(conn.peek().len, data_avail);
582582
conn.drop(@intCast(u16, nread));
583583
r.next_chunk_length -= nread;
584-
} else {
584+
} else if (out_avail > 0) {
585585
const can_read = @intCast(usize, @min(data_avail, out_avail));
586586
const nread = try conn.read(buffer[out_index..][0..can_read]);
587587
r.next_chunk_length -= nread;

0 commit comments

Comments
 (0)