| ... | @@ -962,6 +962,7 @@ pub const BodyWriter = struct { | ... | @@ -962,6 +962,7 @@ pub const BodyWriter = struct { |
| 962 | // have to flush the chunk header before knowing the chunk length. | 962 | // have to flush the chunk header before knowing the chunk length. |
| 963 | return error.Unimplemented; | 963 | return error.Unimplemented; |
| 964 | }; | 964 | }; |
| | 965 | if (data_len == 0) return error.EndOfStream; |
| 965 | const out = bw.http_protocol_output; | 966 | const out = bw.http_protocol_output; |
| 966 | l: switch (bw.state.chunk_len) { | 967 | l: switch (bw.state.chunk_len) { |
| 967 | 0 => { | 968 | 0 => { |
| ... | @@ -975,8 +976,7 @@ pub const BodyWriter = struct { | ... | @@ -975,8 +976,7 @@ pub const BodyWriter = struct { |
| 975 | 2 => { | 976 | 2 => { |
| 976 | try out.writeAll("\r\n"); | 977 | try out.writeAll("\r\n"); |
| 977 | bw.state.chunk_len = 0; | 978 | bw.state.chunk_len = 0; |
| 978 | assert(file_reader.atEnd()); | 979 | continue :l 0; |
| 979 | return error.EndOfStream; | | |
| 980 | }, | 980 | }, |
| 981 | else => { | 981 | else => { |
| 982 | const chunk_limit: std.Io.Limit = .limited(bw.state.chunk_len - 2); | 982 | const chunk_limit: std.Io.Limit = .limited(bw.state.chunk_len - 2); |
| ... | @@ -985,8 +985,7 @@ pub const BodyWriter = struct { | ... | @@ -985,8 +985,7 @@ pub const BodyWriter = struct { |
| 985 | else | 985 | else |
| 986 | try out.write(chunk_limit.slice(w.buffered())); | 986 | try out.write(chunk_limit.slice(w.buffered())); |
| 987 | bw.state.chunk_len -= n; | 987 | bw.state.chunk_len -= n; |
| 988 | const ret = w.consume(n); | 988 | return w.consume(n); |
| 989 | return ret; | | |
| 990 | }, | 989 | }, |
| 991 | } | 990 | } |
| 992 | } | 991 | } |