Skip to content

Download a single chunk if the server does not support the Range header#10

Merged
rogerfar merged 1 commit into
rogerfar:mainfrom
Cucumberrbob:fix/single-chunk-when-no-accept-range
May 18, 2025
Merged

Download a single chunk if the server does not support the Range header#10
rogerfar merged 1 commit into
rogerfar:mainfrom
Cucumberrbob:fix/single-chunk-when-no-accept-range

Conversation

@Cucumberrbob
Copy link
Copy Markdown
Contributor

@Cucumberrbob Cucumberrbob commented May 4, 2025

Fixes #9. See also rogerfar/rdt-client/issues/782

I've tested with with rdt-client downloading a TorBox zip (and regular downloads from AD, which sets Accept-Ranges).

Currently, we just assume that every server respects the Range header. But not all do. If they don't we end up downloading the whole file for every chunk we want to download.

This PR adds a step when we perform the HEAD request to get the Content-Length to also check if the server supports the Range header. Servers should1 put the Accept-Ranges: bytes header in the HEAD response if they support the Range header on the subsequent GET requests.

Footnotes

  1. TorBox don't set this header for their non-zipped download links. I've reached out to them via discord to see if they can set it. AD, DL, PM and RD all set this header correctly.

@rogerfar rogerfar merged commit 07e5d38 into rogerfar:main May 18, 2025
1 check passed
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.

Downloads exceed 100% with multiple chunks on servers which don't respect the Range header

2 participants