╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │107 host: Host, │ │108 err: *std.Io.Writer, │ │109 ) !void { │ │110 - var send_buffer = [_]u8{0} ** 4096; │ │111 - var recv_buffer = [_]u8{0} ** 4096; │ │110 + var send_buffer: [4096]u8 = @splat(0); │ │111 + var recv_buffer: [4096]u8 = @splat(0); │ │112 var conn_br = stream.reader(io, &recv_buffer); │ │113 var conn_bw = stream.writer(io, &send_buffer); │ │114 var http_server = std.http.Server.init(&conn_br.interface, &conn_bw.interface);│ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │157 .server => |server| { │ │158 // "repo/new" and "user/new" come before "new", which would claim them │ │159 const PostRoute = enum { login, logout, @"repo/new", @"user/new", repo, new, edit, remove, open, close, resolve, publish, merge, squash, attach, undo, clear };│ │160 - inline for (@typeInfo(PostRoute).@"enum".fields) |field| { │ │161 - const suffix = "/" ++ field.name; │ │160 + inline for (@typeInfo(PostRoute).@"enum".field_names) |name| { │ │161 + const suffix = "/" ++ name; │ │162 if (std.mem.endsWith(u8, path, suffix)) { │ │163 const base = path[0 .. path.len - suffix.len]; │ │164 - return switch (@field(PostRoute, field.name)) { │ │164 + return switch (@field(PostRoute, name)) { │ │165 .login => handleLogin(io, request, allocator, base, server.admin_repo_path, server.session_store), │ │166 .logout => handleLogout(request, base, server.session_store), │ │167 .@"repo/new" => handleRepoNew(io, request, allocator, path, server.admin_repo_path, server.users_dir, server.session_store), │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │185 }, │ │186 .local => |local| { │ │187 const PostRoute = enum { new, edit, remove, open, close, resolve, sync, attach, undo, clear };│ │188 - inline for (@typeInfo(PostRoute).@"enum".fields) |field| { │ │189 - const suffix = "/" ++ field.name; │ │188 + inline for (@typeInfo(PostRoute).@"enum".field_names) |name| { │ │189 + const suffix = "/" ++ name; │ │190 if (std.mem.endsWith(u8, path, suffix)) { │ │191 const base = path[0 .. path.len - suffix.len]; │ │192 - return switch (@field(PostRoute, field.name)) { │ │192 + return switch (@field(PostRoute, name)) { │ │193 .new => handleNew(io, request, allocator, base, host), │ │194 .edit => handleEdit(io, request, allocator, base, host), │ │195 .remove => handleRemove(io, request, allocator, base, host), │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │329 defer allocator.free(html); │ │330 │ │331 const expired_form_cookie = if (form_cookie_seen) │ │332 - try std.fmt.allocPrint(allocator, form_flash_cookie ++ "=; Path={s}; Max-Age=0", .{path})│ │332 + try allocator.print(form_flash_cookie ++ "=; Path={s}; Max-Age=0", .{path}) │ │333 else │ │334 null; │ │335 defer if (expired_form_cookie) |cookie| allocator.free(cookie); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │375 // on success, return to the page the login came from (base, or "/" at the │ │376 // root); on failure, stay on its user tab to surface the error. │ │377 const success_location: []const u8 = if (base.len == 0) "/" else base; │ │378 - const failure_location = try std.fmt.allocPrint(arena.allocator(), "{s}/user", .{base});│ │378 + const failure_location = try arena.allocator().print("{s}/user", .{base}); │ │379 │ │380 switch (result) { │ │381 .success => |user_id| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │397 │ │398 fn respondFormFailure(request: *std.http.Server.Request, allocator: std.mem.Allocator, session_store: SessionStore, location: []const u8, feedback: ui.Session.FormFeedback) !void {│ │399 const token = try session_store.createFlash(allocator, feedback); │ │400 - const cookie = try std.fmt.allocPrint(allocator, form_flash_cookie ++ "={s}; Path={s}; HttpOnly; SameSite=Strict", .{ token, location }); │ │400 + const cookie = try allocator.print(form_flash_cookie ++ "={s}; Path={s}; HttpOnly; SameSite=Strict", .{ token, location }); │ │401 defer allocator.free(cookie); │ │402 try request.respond("", .{ │ │403 .status = .see_other, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │420 else => false, │ │421 }; │ │422 if (!required_title) return error.InvalidFormFeedback; │ │423 - const cookie = try std.fmt.allocPrint(allocator, local_flash_cookie ++ "=" ++ local_required_title_prefix ++ "{s}; Path=/; HttpOnly; SameSite=Strict", .{@tagName(tag)});│ │423 + const cookie = try allocator.print(local_flash_cookie ++ "=" ++ local_required_title_prefix ++ "{s}; Path=/; HttpOnly; SameSite=Strict", .{@tagName(tag)}); │ │424 defer allocator.free(cookie); │ │425 try request.respond("", .{ │ │426 .status = .see_other, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────╮ │651 } } }); │ │652 }; │ │653 │ │654 - const location = try std.fmt.allocPrint(allocator, "/{s}:{s}", .{ user.event.name, name });│ │654 + const location = try allocator.print("/{s}:{s}", .{ user.event.name, name }); │ │655 defer allocator.free(location); │ │656 try request.respond("", .{ │ │657 .status = .see_other, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │749 const token = try session_store.create(&user_id); │ │750 var cookie_buf: [256]u8 = undefined; │ │751 const cookie = try std.fmt.bufPrint(&cookie_buf, session_cookie_fmt, .{token});│ │752 - const location = try std.fmt.allocPrint(allocator, "/{s}", .{name}); │ │752 + const location = try allocator.print("/{s}", .{name}); │ │753 defer allocator.free(location); │ │754 try request.respond("", .{ │ │755 .status = .see_other, │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │805 .discuss => "discussions", │ │806 else => unreachable, │ │807 }; │ │808 - const form_location = try std.fmt.allocPrint(allocator, "{s}/{s}/new", .{ base, list_name }); │ │808 + const form_location = try allocator.print("{s}/{s}/new", .{ base, list_name }); │ │809 defer allocator.free(form_location); │ │810 if (!evt.titleValid(title)) { │ │811 return respondThreadFormFailure(request, allocator, host, form_location, requiredTitleFeedback(kind, title, labels, description, target_branch, source_branch));│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯