╭ changed ─────────╮ │src/serve_http.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────╮ │10 allocator: std.mem.Allocator, │ │11 repo_root_path: []const u8, │ │12 admin_repo_path: []const u8, │ │13 - is_test: bool, │ │13 net_server: *std.Io.net.Server,│ │14 tasks: *std.Io.Group, │ │15 err: *std.Io.Writer, │ ╰───────────────────────────────────────╯ ╭─────────────────────────────────────────╮ │19 allocator: std.mem.Allocator,│ │20 repo_root_path: []const u8, │ │21 admin_repo_path: []const u8, │ │23 - is_test: bool, │ │22 err: *std.Io.Writer, │ │23 }; │ │24 │ ╰─────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │25 const handle = struct { │ │26 fn h(ctx: Context, stream: std.Io.net.Stream) void { │ │27 defer stream.close(ctx.io); │ │30 - handleConnection(repo_kind, any_repo_opts, ctx.io, ctx.allocator, ctx.repo_root_path, ctx.admin_repo_path, ctx.is_test, stream, ctx.err) catch |request_err| {│ │28 + handleConnection(repo_kind, any_repo_opts, ctx.io, ctx.allocator, ctx.repo_root_path, ctx.admin_repo_path, stream, ctx.err) catch |request_err| { │ │29 serve_common.logError(ctx.err, "connection failed: {s}\n", .{@errorName(request_err)}); │ │30 }; │ │31 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────╮ │36 .allocator = allocator, │ │37 .repo_root_path = repo_root_path, │ │38 .admin_repo_path = admin_repo_path,│ │41 - .is_test = is_test, │ │39 .err = err, │ │40 }, handle); │ │41 } │ ╰───────────────────────────────────────────────╯ ╭─────────────────────────────────────╮ │47 allocator: std.mem.Allocator,│ │48 repo_root_path: []const u8, │ │49 admin_repo_path: []const u8, │ │53 - is_test: bool, │ │50 stream: std.Io.net.Stream, │ │51 err: *std.Io.Writer, │ │52 ) !void { │ ╰─────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │63 else => |e| return e, │ │64 }; │ │65 │ │70 - handleGitRequest(repo_kind, any_repo_opts, io, allocator, repo_root_path, admin_repo_path, is_test, &http_server, &request) catch |request_err| {│ │66 + handleGitRequest(repo_kind, any_repo_opts, io, allocator, repo_root_path, admin_repo_path, &http_server, &request) catch |request_err| { │ │67 try err.print("request failed: {s}\n", .{@errorName(request_err)}); │ │68 try err.flush(); │ │69 if (http_server.reader.state == .received_head) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────╮ │83 allocator: std.mem.Allocator, │ │84 repo_root_path: []const u8, │ │85 admin_repo_path: []const u8, │ │90 - is_test: bool, │ │86 http_server: *std.http.Server, │ │87 request: *std.http.Server.Request,│ │88 ) !void { │ ╰──────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │111 const has_remote_user = findHeader(request, "authorization") != null; │ │112 const protocol_version = protocolVersionFromHeader(findHeader(request, "git-protocol"));│ │113 │ │119 - const create_if_missing = isReceivePack(handler, suffix, uri.query); │ │120 - │ │121 - // pushing over HTTP is disabled outside test mode; pushes go over SSH │ │122 - if (create_if_missing and !is_test) { │ │114 + // pushing over HTTP is not supported; pushes go over SSH │ │115 + if (isReceivePack(handler, suffix, uri.query)) { │ │116 if (http_server.reader.state == .received_head) { │ │117 http_server.reader.state = .ready; │ │118 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │126 - try writeSimpleResponse(http_server, 403, "Forbidden", "text/plain", "push over HTTP is disabled"); │ │119 + try writeSimpleResponse(http_server, 403, "Forbidden", "text/plain", "push over HTTP is not supported");│ │120 return; │ │121 } │ │122 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │130 http_server.reader.state = .ready; │ │131 } │ │132 │ │140 - const repo_path = switch (try serve_common.resolveRepoPath(io, allocator, is_test, repo_root_path, admin_repo_path, repo_rel, create_if_missing)) {│ │133 + const repo_path = switch (try serve_common.resolveRepoPath(io, allocator, repo_root_path, admin_repo_path, repo_rel, false)) { │ │134 .ok => |p| p, │ │135 .invalid => return writeSimpleResponse(http_server, 400, "Bad Request", "text/plain", "repo path must be <owner>/<repo>"), │ │136 .not_found => return error.RepoNotFound, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯