| ... | ... | @@ -809,8 +809,9 @@ pub const BodyWriter = struct { |
| 809 | 809 | end, |
| 810 | 810 | |
| 811 | 811 | pub const Chunked = union(enum) { |
| 812 | | /// Index of the hex-encoded chunk length in the chunk header |
| 813 | | /// within the buffer of `BodyWriter.http_protocol_output`. |
| 812 | /// Index to the start of the hex-encoded chunk length in the chunk |
| 813 | /// header within the buffer of `BodyWriter.http_protocol_output`. |
| 814 | /// Buffered chunk data starts here plus length of `chunk_header_template`. |
| 814 | 815 | offset: usize, |
| 815 | 816 | /// We are in the middle of a chunk and this is how many bytes are |
| 816 | 817 | /// left until the next header. This includes +2 for "\r"\n", and |
| ... | ... | @@ -830,7 +831,7 @@ pub const BodyWriter = struct { |
| 830 | 831 | .end, .none, .content_length => return w.http_protocol_output.flush(), |
| 831 | 832 | .chunked => |*chunked| switch (chunked.*) { |
| 832 | 833 | .offset => |*offset| { |
| 833 | | try w.http_protocol_output.flushLimit(.limited(w.http_protocol_output.end - offset.*)); |
| 834 | try w.http_protocol_output.flushLimit(.limited(offset.*)); |
| 834 | 835 | offset.* = 0; |
| 835 | 836 | }, |
| 836 | 837 | .chunk_len => return w.http_protocol_output.flush(), |
| ... | ... | @@ -1025,8 +1026,8 @@ pub const BodyWriter = struct { |
| 1025 | 1026 | }, |
| 1026 | 1027 | .chunk_len => |chunk_len| l: switch (chunk_len) { |
| 1027 | 1028 | 0 => { |
| 1028 | | const header_buf = try bw.writableArray(chunk_header_template.len); |
| 1029 | 1029 | const off = bw.end; |
| 1030 | const header_buf = try bw.writableArray(chunk_header_template.len); |
| 1030 | 1031 | @memcpy(header_buf, chunk_header_template); |
| 1031 | 1032 | chunked.* = .{ .offset = off }; |
| 1032 | 1033 | continue :state .{ .offset = off }; |
| ... | ... | @@ -1074,8 +1075,8 @@ pub const BodyWriter = struct { |
| 1074 | 1075 | }, |
| 1075 | 1076 | .chunk_len => |chunk_len| l: switch (chunk_len) { |
| 1076 | 1077 | 0 => { |
| 1077 | | const header_buf = try bw.writableArray(chunk_header_template.len); |
| 1078 | 1078 | const offset = bw.end; |
| 1079 | const header_buf = try bw.writableArray(chunk_header_template.len); |
| 1079 | 1080 | @memcpy(header_buf, chunk_header_template); |
| 1080 | 1081 | chunked.* = .{ .offset = offset }; |
| 1081 | 1082 | continue :state .{ .offset = offset }; |