mirror of
https://github.com/ziglang/zig.git
synced 2026-02-19 07:48:31 +00:00
std.http.Server: protect against zero-length chunks
companion commit to 919a3bae1c5f2024b09e127a15c752d9dc0aa9a6
This commit is contained in:
parent
90bd4f226e
commit
b47bd031ca
@ -693,9 +693,11 @@ pub const Response = struct {
|
||||
|
||||
switch (res.transfer_encoding) {
|
||||
.chunked => {
|
||||
try res.connection.writer().print("{x}\r\n", .{bytes.len});
|
||||
try res.connection.writeAll(bytes);
|
||||
try res.connection.writeAll("\r\n");
|
||||
if (bytes.len > 0) {
|
||||
try res.connection.writer().print("{x}\r\n", .{bytes.len});
|
||||
try res.connection.writeAll(bytes);
|
||||
try res.connection.writeAll("\r\n");
|
||||
}
|
||||
|
||||
return bytes.len;
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user