You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gateway: prove a raw blob's size before its first byte, so its first request has a length #2645
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
fix(gateway,client): size a verified raw blob, and adopt the size ope…
feat(gateway,client): prove a raw blob's size before its first byte