Add Metalink 4 (RFC 5854) support#228
Open
ashledombos wants to merge 1 commit into
Open
Conversation
Add a ?meta4 endpoint (also triggered by an Accept: application/metalink4+xml header) that returns a Metalink 4.0 document for the requested file: its size, checksums, and the list of candidate mirrors ordered by preference. This lets Metalink-aware clients (aria2, wget2, ...) perform the final mirror selection, download from several mirrors and resume/verify the transfer themselves, instead of relying on a single 302 redirect. The mirror list reuses the existing selection engine. As with the mirrorlist output, the full candidate list is returned (no 5-mirror cap and no random reordering) so clients can fail over across all of them. Closes videolabs#49
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.
Implements a
?meta4endpoint serving a Metalink 4.0 / RFC 5854 document for the requested file, as requested in #49.What it does
A request carrying
?meta4(or anAccept: application/metalink4+xmlheader) returns, instead of a 302 redirect, a Metalink document describing the file — its size, checksums, and the list of candidate mirrors ordered by preference:Served with
Content-Type: application/metalink4+xml.Why
Metalink-aware clients (aria2, wget2, ...) can then perform the final mirror selection, download from several mirrors and resume/verify the transfer themselves, instead of being tied to a single redirect — i.e. the traffic distribution, integrity check and resumable downloads asked for in #49.
Implementation notes
?mirrorlist, the full candidate list is returned (no 5-mirror cap and no random reordering) so clients can fail over across all mirrors.sha-256,sha-1,md5); only the checksums actually computed for the file are emitted (honouring theHashesconfig).<file name>is the basename;<url priority>is 1-based (1 = most preferred).Tested
go test ./http/... ./mirrors/...passes.aria2c -M): it parses the document, downloads from a mirror and verifies the checksum successfully.Not included (possible follow-up)
<pieces>) for segmented repair: mirrorbits does not currently compute block-level hashes.Closes #49