fix(upload): raise Rocket data limits to match CHUNK_SIZE - #105
Merged
Conversation
Closes #38. Rocket's default body-size limit for \`bytes\`, \`data-form\`, and \`file\` is 1 MiB. When a client sends a chunk larger than 1 MiB (CHUNK_SIZE is 10 MiB as of #104), Rocket rejects the request body with "Data limit reached while reading the request body" before \`data.open(...)\` in \`upload_chunk\` has a chance to apply its own per-request cap. Raises all three framework-level limits to CHUNK_SIZE + 1 MiB headroom via \`rocket::Config::figment().merge(("limits", ...))\` so existing Rocket.toml / \`ROCKET_CONFIG\` settings still compose with it. The per-request \`(end - start).bytes()\` cap in \`upload_chunk\` remains the authoritative limit — this change only lifts the framework floor that was clipping legitimate chunks.
rubenhensen
marked this pull request as ready for review
April 24, 2026 07:19
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #38.
Rocket's default body-size limit for
bytes,data-form, andfileis 1 MiB. Since #104 landed withCHUNK_SIZE = 10 MiB, any chunk over 1 MiB gets rejected with "Data limit reached while reading the request body" — Rocket trims the body before the handler'sdata.open((end - start).bytes())cap runs. The issue explicitly mentions this and the chunks >1 MiB failing uploads.Fix
Merge framework-level
limitsontoRocket::Config::figment()inrocket::custom(...):1 MiB of headroom above
CHUNK_SIZEfor HTTP overhead. The per-request(end - start).bytes()cap inupload_chunkremains the authoritative limit — this change only lifts the framework floor that was clipping legitimate chunks.rocket::Config::figment()still readsROCKET_CONFIG/Rocket.tomlbefore the merge, so existing deployed[global.*]settings continue to take effect.Verification
cargo build --release— green.cargo test— 5/5 pass (the existing store tests; no new tests needed for a config-only change).cargo clippy --all-targets— only the pre-existinguseless_formatwarning insrc/email.rs:225.Interactive 10 MiB upload not reproduced in the workspace — cryptify's runtime needs a live PKG at startup and a client that produces a chunked Content-Range PUT, which wasn't feasible here. The issue reporter already observed the failure mode before and explicitly asked for "dynamically change datalimit based on chunk size"; this does exactly that at framework startup. Keeping as draft so a maintainer can confirm on staging.
Reviewer quickstart