Skip to content

gateway: prove a raw blob's size before its first byte, so its first request has a length #2645

Closed

Description

@thiras

Follow-up to #2616.

Today. A raw blob gets Content-Length, HEAD and Range once a whole pull on the gateway has verified its size. The first request for a raw blob still streams with no length, ignores Range, and its HEAD has no length.

Why the first claim is not enough. #2616 asked for the length to come from the first node's size claim. A probe's size is unsigned, and a header's signed size is still only a claim until the final chunk verifies. Neither may become Content-Length. The server stops reading a response body once it reaches its declared length, so a claim below the real size ends a capped pull as a whole response: the client keeps a cut file and sees no error. A claim above the real size wrongly refuses the blob with a 402 or a 416. The review of the #2616 branch found this.

Ask. Prove the size before the first byte, then answer with it. ADR 039 already states that a leg that verifies the final chunk proves the size. Options to weigh:

  • Before the pull, pay for the last chunk group under the claimed size. If it verifies, the size is proven: answer with the length and record it in SizeHints. The cost is one chunk group and its proof per new blob. Decide whether HEAD may spend it.
  • Hold the response headers until the pull's drive proves the size. That only works for a blob small enough to land before the client gives up.

Whatever the choice, a short pull must never end as a whole response. Keep the unit test that a raw blob of unverified size has no length.

Activity

  1. added
    kind:feature
    area:cli
    on Oct 27, 2026
  2. self-assigned this
    on Oct 27, 2026
  3. moved this from Backlog to In progress in deCDNon Oct 27, 2026
  4. added a commit that references this issue on Oct 27, 2026
    f55f6c1
  5. moved this from In progress to Done in deCDNon Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clikind:feature

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions