| ... | @@ -797,18 +797,18 @@ pub const Request = struct { | ... | @@ -797,18 +797,18 @@ pub const Request = struct { |
| 797 | | 797 | |
| 798 | /// Write `bytes` to the server. The `transfer_encoding` request header determines how data will be sent. | 798 | /// Write `bytes` to the server. The `transfer_encoding` request header determines how data will be sent. |
| 799 | pub fn write(req: *Request, bytes: []const u8) WriteError!usize { | 799 | pub fn write(req: *Request, bytes: []const u8) WriteError!usize { |
| 800 | switch (req.headers.transfer_encoding) { | 800 | switch (req.transfer_encoding) { |
| 801 | .chunked => { | 801 | .chunked => { |
| 802 | try req.connection.data.conn.writer().print("{x}\r\n", .{bytes.len}); | 802 | try req.connection.data.buffered.writer().print("{x}\r\n", .{bytes.len}); |
| 803 | try req.connection.data.conn.writeAll(bytes); | 803 | try req.connection.data.buffered.writeAll(bytes); |
| 804 | try req.connection.data.conn.writeAll("\r\n"); | 804 | try req.connection.data.buffered.writeAll("\r\n"); |
| 805 | | 805 | |
| 806 | return bytes.len; | 806 | return bytes.len; |
| 807 | }, | 807 | }, |
| 808 | .content_length => |*len| { | 808 | .content_length => |*len| { |
| 809 | if (len.* < bytes.len) return error.MessageTooLong; | 809 | if (len.* < bytes.len) return error.MessageTooLong; |
| 810 | | 810 | |
| 811 | const amt = try req.connection.data.conn.write(bytes); | 811 | const amt = try req.connection.data.buffered.write(bytes); |
| 812 | len.* -= amt; | 812 | len.* -= amt; |
| 813 | return amt; | 813 | return amt; |
| 814 | }, | 814 | }, |
| ... | @@ -828,7 +828,7 @@ pub const Request = struct { | ... | @@ -828,7 +828,7 @@ pub const Request = struct { |
| 828 | /// Finish the body of a request. This notifies the server that you have no more data to send. | 828 | /// Finish the body of a request. This notifies the server that you have no more data to send. |
| 829 | pub fn finish(req: *Request) FinishError!void { | 829 | pub fn finish(req: *Request) FinishError!void { |
| 830 | switch (req.transfer_encoding) { | 830 | switch (req.transfer_encoding) { |
| 831 | .chunked => try req.connection.data.conn.writeAll("0\r\n\r\n"), | 831 | .chunked => try req.connection.data.buffered.writeAll("0\r\n\r\n"), |
| 832 | .content_length => |len| if (len != 0) return error.MessageNotCompleted, | 832 | .content_length => |len| if (len != 0) return error.MessageNotCompleted, |
| 833 | .none => {}, | 833 | .none => {}, |
| 834 | } | 834 | } |