Repository navigation
Conversation
thiras
added a commit
that referenced
this pull request
Oct 24, 2026
Co-Authored-By: Claude Fable 5.1 <[email protected]>
thiras
force-pushed
the
feat/gateway-public
branch
from
October 24, 2026 16:37
3453643 to
7ac2af5
Compare
A bundle entry whose manifest declares its size takes one `Range`: `bytes=a-b`, `bytes=a-` or `bytes=-n`. The response is 206 over exactly that window, with `Content-Range` and the window's `Content-Length`, and the pull (`BlobFetch.range`, through `Streamer::open_range`) pays only for the chunk-group-aligned span around the window. The allowance admits and charges the request by that span, so two bytes inside a chunk group cost what the pull pays for them. A range that starts past the end is 416 with the entry's size. A range the gateway cannot honour is ignored, as HTTP allows: several ranges, another unit, a malformed or inverted one, a page rewritten as it streams, a blob whose size nothing declares. A sized response advertises `Accept-Ranges: bytes`, on `HEAD` too, so `curl -r`, a resumed download and a BEP 19 webseed all work. The entry's declared size still caps the pull. Part of #2593. Co-Authored-By: Claude Fable 5.1 <[email protected]>
thiras
force-pushed
the
feat/gateway-range
branch
from
October 24, 2026 16:48
4043e5f to
e462667
Compare
8 tasks done
Contributor
Author
This was referenced Oct 24, 2026
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.
What
The gateway answers HTTP
Rangeon a bundle entry whose manifest declares its size (#2593, thecurl/wgetand BEP 19 webseed shims):bytes=a-b,bytes=a-andbytes=-n→206 Partial Contentover exactly that window, withContent-Range: bytes a-b/sizeand the window'sContent-Length. The pull carries the window (BlobFetch.range) intoStreamer::open_range(feat(client):Streamer::open_rangestreams one verified byte window #2607), so it opens and pays for one leg over the chunk-group-aligned span around the window and nothing else (ADR 038).416withContent-Range: bytes */size, no pull.200: several ranges, another unit, a malformed or inverted range, a page the gateway rewrites as it streams (its length changes), a raw blob whose size nothing declares.Accept-Ranges: bytesonGETandHEAD; an unsized one does not, so a resuming client (huggingface_hubincluded) never sends a range the gateway would answer whole.Extent::billable), with the difference to the window charged when the stream starts. An automated pass on the first push caught that charging the window alone let two-byte ranges pay a 16 KiB group each; two tests pin the span (a_range_is_admitted_by_its_aligned_span,a_range_is_charged_by_its_aligned_span). The entry's declared size still caps the pull (size_cap), and the "delivered whole" check counts the window.Stacked on #2608 (
feat/gateway-public, rebased onto its latest); the diff shown is against that branch. Part of #2593.Reviewer notes
gateway.rs:byte_windowis the whole header grammar;Extentcarries the declared size, the window and whether the response has a fixed length, and replaces thesize: Option<u64>parameter ofstream;Extent::ofdecides honour / ignore / 416 in one place andentry/indexcall it.fetch.rs:BlobFetch.rangeand theopen/open_rangematch instream_out;decdn getsetsrange: Noneeverywhere. Ranges work on the loopback gateway too (same code path); nothing there changes otherwise.Verification
Always:
pre-commit runon commit (all hooks passed;cargo denyfindings are the known warn-only advisories)CARGO_BUILD_WARNINGS=deny cargo clippy -p decdn-cli -p decdn-common -p decdn-e2e --all-targets --all-features: clean (the workspace run was clean on the base; this PR touches those three crates)cargo nextest run -p decdn-cli -p decdn-common -p decdn-e2e: 1514 passedOnly if touched:
cargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(gateway_public)'passes with the new step: an off-gridRangereturns 206 and the byte-exact window withContent-Range, andbytes=<size>-returns 416. The client log shows one legbyte_offset=1048576 byte_len=1589248for the 1,572,864-byte window.CHANGELOG.mdentry added by handObservation, not in scope: the node's
decdn_bytes_served_totalreported 3,692,992 for that single 1,589,248-byte leg and 5,275,910 for a whole 4 MiB pull, so its unit is not payload bytes; I dropped the node-side assertion from the e2e rather than encode that.🤖 Generated with Claude Code