diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2025-08-16 13:11:19 +0200 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2025-08-16 22:07:16 +0200 |
| commit | 0cfd07bc865efa4b74d32b16b7dfd1a68167ce14 (patch) | |
| tree | 95e00d211eecf729491a4f2004834c95b04c3159 /lib/std/http | |
| parent | ce4e8a991f4d3d6f8b3f1f987fb955af9238ab53 (diff) | |
| download | zig-0cfd07bc865efa4b74d32b16b7dfd1a68167ce14.tar.gz zig-0cfd07bc865efa4b74d32b16b7dfd1a68167ce14.zip | |
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.
Diffstat (limited to 'lib/std/http')
| -rw-r--r-- | lib/std/http/Client.zig | 2 | ||||
| -rw-r--r-- | lib/std/http/Server.zig | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig index fe28a930a4..f6a02c708f 100644 --- a/lib/std/http/Client.zig +++ b/lib/std/http/Client.zig @@ -907,7 +907,7 @@ pub const Request = struct { return switch (r.transfer_encoding) { .chunked => .{ .http_protocol_output = http_protocol_output, - .state = .{ .chunked = .init }, + .state = .init_chunked, .writer = .{ .buffer = buffer, .vtable = &.{ diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig index ebea94acc9..e09d5803de 100644 --- a/lib/std/http/Server.zig +++ b/lib/std/http/Server.zig @@ -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, }, |
