Skip to content

fix(multipart): stream part bodies past rejected boundary prefixes - #58

Merged
fengmk2 merged 1 commit into
mainfrom
fix/multipart-bounded-buffer
Nov 13, 2026
Merged

fengmk2 merged 1 commit into
mainfrom
fix/multipart-bounded-buffer

Conversation

@fengmk2

@fengmk2 fengmk2 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

A boundary prefix (\r\n--<boundary>) followed by padding and a byte other than CRLF is body data. The part body generator still searched the whole buffer for the next prefix before it yielded anything. So a store body that repeats such prefixes was held in memory up to the 72 MiB store limit, with a full buffer copy on every 64 KiB read. The metadata (5 MiB) and blob (64 MiB) limits never ran, because they only see yielded chunks. Only an authorized publisher can send a store body.

The generator now yields through the first byte of each rejected prefix before it searches again. No delimiter can start earlier, so the stored bytes are the same; only the chunking changes.

Body with padded prefixes every 8 KiB Largest parser buffer before After
1 MiB 1.00 MiB 0.08 MiB
8 MiB 8.00 MiB 0.08 MiB

🤖 Generated with Claude Code

A boundary prefix followed by padding and a non-CRLF byte is body data, but the
part body generator searched the whole buffer for the next prefix before it
yielded anything. A body that repeats such prefixes was held in memory up to
the 72 MiB store limit, with a full buffer copy on every 64 KiB read, and the
metadata and blob size limits never ran.

Yield through the first byte of each rejected prefix before searching again.
No delimiter can start earlier, so the yielded bytes are the same; only the
chunking changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fengmk2
fengmk2 added this pull request to stack #62 November 13, 2026 05:31
@github-actions

Copy link
Copy Markdown

Remote cache staging

Commit: 7f51a2ce3770633f5a473f7a8e5c58e28f7315da

Cloudflare deployment is disabled. Configure the repository secrets and variables described in the e2e plan, then set REMOTE_CACHE_DEPLOY_ENABLED=true and rerun this workflow. No live deployment passed verification.

Manual checks and complete e2e plan.

@fengmk2
fengmk2 marked this pull request as ready for review November 13, 2026 06:13
@fengmk2
fengmk2 merged commit ef723e8 into main Nov 13, 2026
6 checks passed
@fengmk2
fengmk2 deleted the fix/multipart-bounded-buffer branch November 13, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant