authorgravatar for nwtgck@nwtgck.orgRyo Ota <nwtgck@nwtgck.org> 2023-04-20 22:03:01+09:00
committergravatar for nwtgck@nwtgck.orgRyo Ota <nwtgck@nwtgck.org> 2023-04-20 22:19:00+09:00
log0f4f6078143e67d50bfd66840e31cf3b38987261
tree15016d3a5c16e17284f740da8c97d28a22af5715
parentd80e6ca5a6843cb3911ec2d0b2da8b4ae515202a

fix http client build error


1 files changed, 6 insertions(+), 6 deletions(-)

lib/std/http/Client.zig+6-6
...@@ -797,18 +797,18 @@ pub const Request = struct {...@@ -797,18 +797,18 @@ pub const Request = struct {
797797
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");
805805
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;
810810
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 }