Commit abd76938cb
Changed files (2)
lib
std
http
lib/std/http/test.zig
@@ -414,7 +414,8 @@ test "general client/server API coverage" {
log.info("{f} {t} {s}", .{ request.head.method, request.head.version, request.head.target });
const gpa = std.testing.allocator;
- const body = try (try request.readerExpectContinue(&.{})).allocRemaining(gpa, .unlimited);
+ const reader = (try request.readerExpectContinue(&.{}));
+ const body = try reader.allocRemaining(gpa, .unlimited);
defer gpa.free(body);
if (mem.startsWith(u8, request.head.target, "/get")) {
lib/std/Io/Reader.zig
@@ -367,8 +367,11 @@ pub fn appendRemainingUnlimited(
const buffer_contents = r.buffer[r.seek..r.end];
try list.ensureUnusedCapacity(gpa, buffer_contents.len + bump);
list.appendSliceAssumeCapacity(buffer_contents);
- r.seek = 0;
- r.end = 0;
+ // If statement protects `ending`.
+ if (r.end != 0) {
+ r.seek = 0;
+ r.end = 0;
+ }
// From here, we leave `buffer` empty, appending directly to `list`.
var writer: Writer = .{
.buffer = undefined,