Skip to content

fix(streaming): support resume and seeking for server downloads (builds on #986) - #1012

Open
ashtonian wants to merge 4 commits into
madeofpendletonwool:mainfrom
ashtonian:fix/stream-range-validation-upstream
Open

ashtonian wants to merge 4 commits into
madeofpendletonwool:mainfrom
ashtonian:fix/stream-range-validation-upstream

Conversation

@ashtonian

@ashtonian ashtonian commented Oct 18, 2026 •

Copy link
Copy Markdown

Builds on @honzup's #986 to restore resume and seeking for episodes downloaded on the PinePods server (#980). #986 forwards Range and conditional headers to ServeFile so the player can request part of a file. Its original commit is preserved; credit to @davegallant for the original diagnosis.

Adds on top of #986:

  • Implements If-Range validation that header forwarding alone does not provide with the current ServeFile version. A matching strong ETag or last-modified date permits a partial response; a stale or weak validator returns the full file instead, preventing old and new file contents from being combined.
  • Preserves the incoming HTTP method and handles HEAD as a metadata-only request. Range and If-Range are ignored for HEAD, including out-of-bounds ranges, so it returns full-file metadata without an audio body.
  • Also forwards If-Match and tests that cache/precondition responses take precedence over range delivery.
  • Extracts file serving into a testable helper and adds seven streaming regression tests plus dedicated CI. Coverage includes full files, bounded/open-ended/suffix ranges, out-of-bounds requests, matching/stale/weak validators, HEAD, and cache conditions.

Validation: all 21 Rust API tests pass on this branch, including the seven streaming regressions. Physical iOS resume/seek testing remains pending; GitHub Actions await maintainer approval. No runtime dependency is added.

This PR contains #986 plus these additions and targets main. If #986 lands separately first, sync this branch before merging.

Related: #980. Protocol reference: RFC 9110 section 14.2. Replaces the closed fork follow-up.

honzup and others added 3 commits September 15, 2026 09:21
stream_episode served local files via tower_http ServeFile but built the
inner request with no headers, so the client Range header was dropped and
every response was 200 + full body. iOS AVPlayer re-fetched from byte 0 on
each buffer refill, making YouTube playback restart every ~60s.

Forward Range/If-Range/If-Modified-Since/If-None-Match/If-Unmodified-Since
into the ServeFile request so it can answer 206 Partial Content.
@ashtonian
ashtonian marked this pull request as ready for review October 18, 2026 02:10
@ashtonian ashtonian changed the title fix(streaming): validate range requests and preserve HEAD (builds on #986) fix(streaming): support resume and seeking for server downloads (builds on #986) Oct 18, 2026

This branch has not been deployed

No deployments
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.

2 participants