mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 08:45:52 +00:00
HTTP client and server send "0\r\n\r\n" when chunked encoding
This commit is contained in:
parent
1fb0b5a044
commit
17af53554e
@ -856,7 +856,7 @@ pub const Request = struct {
|
||||
/// Finish the body of a request. This notifies the server that you have no more data to send.
|
||||
pub fn finish(req: *Request) !void {
|
||||
switch (req.headers.transfer_encoding) {
|
||||
.chunked => req.connection.data.conn.writeAll("0\r\n") catch |err| {
|
||||
.chunked => req.connection.data.conn.writeAll("0\r\n\r\n") catch |err| {
|
||||
req.client.last_error = .{ .write = err };
|
||||
return error.WriteFailed;
|
||||
},
|
||||
|
||||
@ -517,7 +517,7 @@ pub const Response = struct {
|
||||
/// Finish the body of a request. This notifies the server that you have no more data to send.
|
||||
pub fn finish(res: *Response) !void {
|
||||
switch (res.headers.transfer_encoding) {
|
||||
.chunked => try res.connection.writeAll("0\r\n"),
|
||||
.chunked => try res.connection.writeAll("0\r\n\r\n"),
|
||||
.content_length => |len| if (len != 0) return error.MessageNotCompleted,
|
||||
.none => {},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user