http.BodyWriter: handle EOF in chunkedSendFile, simplify
With these changes, the `zig std` command now works again and doesn't trigger assertion failures or mess up the chunked transfer encoding.
This commit is contained in:
@@ -448,11 +448,11 @@ pub const Request = struct {
|
||||
try out.writeAll("\r\n");
|
||||
const elide_body = request.head.method == .HEAD;
|
||||
const state: http.BodyWriter.State = if (o.transfer_encoding) |te| switch (te) {
|
||||
.chunked => .{ .chunked = .init },
|
||||
.chunked => .init_chunked,
|
||||
.none => .none,
|
||||
} else if (options.content_length) |len| .{
|
||||
.content_length = len,
|
||||
} else .{ .chunked = .init };
|
||||
} else .init_chunked;
|
||||
|
||||
return if (elide_body) .{
|
||||
.http_protocol_output = request.server.out,
|
||||
@@ -478,7 +478,7 @@ pub const Request = struct {
|
||||
.drain = http.BodyWriter.contentLengthDrain,
|
||||
.sendFile = http.BodyWriter.contentLengthSendFile,
|
||||
},
|
||||
.chunked => &.{
|
||||
.chunk_len => &.{
|
||||
.drain = http.BodyWriter.chunkedDrain,
|
||||
.sendFile = http.BodyWriter.chunkedSendFile,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user