fix(server): answer every chunk request and out-of-range archive.json policies

The chunk endpoint raised the request body limit only before reading a chunk. A
chunk sent again after a lost answer, or to an unknown or finished upload, was left
unread above Kestrel's 1 MiB default, so Kestrel closed the connection instead of
delivering the answer. The limit is now raised before any answer, to the larger of
the upload's and the server's chunk size, and never lowered.

PUT /api/v1/archive/settings answered 500 when archive.json held a thumbnail size or
proxy quality out of range, which the admin API cannot set. It now answers 409
archive_policy with the policy to correct in details (Server.Error.ArchivePolicy).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 15:58:48 +00:00
1 parent e01887ef51
commit 98f301f5fd
7 files changed
+62 -4

No files matched your search

+2 -1
View File
@@ -54,7 +54,8 @@ public static class UploadEndpoints
/// <summary>
/// Chunks are the only large request bodies; every other endpoint keeps Kestrel's small default limit. The service
/// raises it to the chunk size of this upload (fixed when it started) before it reads the body.
/// raises it before any answer to at least the chunk size of this upload (fixed when it started) and of this server,
/// so a body it leaves unread can still be drained.
/// </summary>
private static async Task<IResult> ChunkAsync(HttpContext context, Caller caller, Guid id, int index, UploadService service)
{