Streaming fails with "range not supported" error despite server supporting byte range requests

Open
#653 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@mickael-menu is already working on this.

Since Jul 17, 2026.

  • #864 by @mickael-menu — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
swift
Domain
networking

Research direction

Start with DefaultHTTPClient.swift, especially the logged request near line 388 and the range-support failure near line 441. Reproduce the issue using the provided publication URL and inspect how the response to the byte-range request is evaluated. Done means streaming succeeds when the server supports byte ranges, while unsupported servers still report the appropriate error.

Written by the indexing model from the issue text.

Description

Describe the bug

When attempting to stream a publication from the Readium publication server, the operation fails with a "range not supported" error, even though the server should support byte range requests. It work on kotlin-toolkit.

☝️ DefaultHTTPClient.swift:388: head https://publication-server.readium.org/Z3M6Ly9yZWFkaXVtLXBsYXlncm91bmQtZmlsZXMvZGVtby9tb2J5LWRpY2suZXB1Yg/manifest.json, headers: ["User-Agent": "BookWalker/0.0.0 iPhone17,3 iOS/18.5 CFNetwork/1.0 Darwin/24.5.0"]
☝️ DefaultHTTPClient.swift:388: get https://publication-server.readium.org/Z3M6Ly9yZWFkaXVtLXBsYXlncm91bmQtZmlsZXMvZGVtby9tb2J5LWRpY2suZXB1Yg/manifest.json, headers: ["User-Agent": "BookWalker/0.0.0 iPhone17,3 iOS/18.5 CFNetwork/1.0 Darwin/24.5.0"]
☝️ DefaultHTTPClient.swift:388: get https://publication-server.readium.org/Z3M6Ly9yZWFkaXVtLXBsYXlncm91bmQtZmlsZXMvZGVtby9tb2J5LWRpY2suZXB1Yg/manifest.json, headers: ["User-Agent": "BookWalker/0.0.0 iPhone17,3 iOS/18.5 CFNetwork/1.0 Darwin/24.5.0", "Range": "bytes=0-3"]
❌ DefaultHTTPClient.swift:441: Streaming ranges requires the remote HTTP server to support byte range requests: https://publication-server.readium.org/Z3M6Ly9yZWFkaXVtLXBsYXlncm91bmQtZmlsZXMvZGVtby9tb2J5LWRpY2suZXB1Yg/manifest.json
❌ DefaultHTTPClient.swift:408: get https://publication-server.readium.org/Z3M6Ly9yZWFkaXVtLXBsYXlncm91bmQtZmlsZXMvZGVtby9tb2J5LWRpY2suZXB1Yg/manifest.json failed with: - ReadiumShared.HTTPError.rangeNotSupported

Code:

let asset = try await readium.assetRetriever.retrieve(url: url).get()
let publication = try await readium.publicationOpener.open(
    asset: asset,
    allowUserInteraction: true,
    credentials: credentials,
    sender: nil
).get()
How to reproduce?
  1. Go to Readium Test App
  2. Import streaming publication: https://publication-server.readium.org/Z3M6Ly9yZWFkaXVtLXBsYXlncm91bmQtZmlsZXMvZGVtby9tb2J5LWRpY2suZXB1Yg/manifest.json
Readium version

3.3.0

OS version

iOS 18.5

Testing device

iPhone 16

Environment
macOS: 15.5
platform: arm64
carthage: 0.40.0
Xcode 16.3
Build version 16E140
Additional context

No response

Dominant language
Swift
Stars
557
Forks
249
Avg merge
3h 52m
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from readium/swift-toolkit

All issues in readium/swift-toolkit

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.