RFC 5854
The Metalink Download Description Format
The Metalink Download Description Format ๐ฆ
okay bestie, meet RFC 5854 โจ It's a Standards Track doc from June 2010 (ISSN 2070-1721), written by A. Bryan, T. Tsujikawa, N. McNab, and P. Poeml from MirrorBrain ๐ Its whole job is defining Metalink, an XML-based download description format. The header doesn't list any Obsoletes or Updates entries, so it's not replacing or patching anything else ๐ธ
Abstract
so the TL;DR is: Metalink describes download locations (mirrors), cryptographic hashes, and other info, and clients can use all that to transfer files reliably and transparently ๐ซถ
Status of This Memo
this is an Internet Standards Track document ๐ฅ It's a product of the IETF, it represents IETF community consensus, got public review, and was approved for publication by the IESG. More on Internet Standards lives in Section 2 of RFC 5741 ๐ Info about current status, errata, and where to send feedback is at http://www.rfc-editor.org/info/rfc5854 ๐
Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved. ๐
the doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as they were on the publication date. Read these carefully, because they spell out your rights and restrictions ๐ And if you pull Code Components out of this doc, they need the Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come with no warranty as described in that license ๐
Table of Contents ๐ง
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2. Namespace and Version . . . . . . . . . . . . . . . . . . 5
1.3. Notational Conventions . . . . . . . . . . . . . . . . . . 5
2. Metalink Documents . . . . . . . . . . . . . . . . . . . . . . 6
3. Common Metalink Constructs . . . . . . . . . . . . . . . . . . 7
3.1. Text Constructs . . . . . . . . . . . . . . . . . . . . . 7
3.2. Date Constructs . . . . . . . . . . . . . . . . . . . . . 8
4. Metalink Element Definitions . . . . . . . . . . . . . . . . . 8
4.1. Container Elements . . . . . . . . . . . . . . . . . . . . 8
4.1.1. The "metalink:metalink" Element . . . . . . . . . . . 8
4.1.2. The "metalink:file" Element . . . . . . . . . . . . . 9
4.1.3. The "metalink:pieces" Element . . . . . . . . . . . . 12
4.2. Metadata Elements . . . . . . . . . . . . . . . . . . . . 12
4.2.1. The "metalink:copyright" Element . . . . . . . . . . . 12
4.2.2. The "metalink:description" Element . . . . . . . . . . 13
4.2.3. The "metalink:generator" Element . . . . . . . . . . . 13
4.2.4. The "metalink:hash" Element . . . . . . . . . . . . . 14
4.2.5. The "metalink:identity" Element . . . . . . . . . . . 15
4.2.6. The "metalink:language" Element . . . . . . . . . . . 15
4.2.7. The "metalink:logo" Element . . . . . . . . . . . . . 16
4.2.8. The "metalink:metaurl" Element . . . . . . . . . . . . 16
4.2.9. The "metalink:origin" Element . . . . . . . . . . . . 18
4.2.10. The "metalink:os" Element . . . . . . . . . . . . . . 18
4.2.11. The "metalink:published" Element . . . . . . . . . . . 18
4.2.12. The "metalink:publisher" Element . . . . . . . . . . . 18
4.2.13. The "metalink:signature" Element . . . . . . . . . . . 19
4.2.14. The "metalink:size" Element . . . . . . . . . . . . . 20
4.2.15. The "metalink:updated" Element . . . . . . . . . . . . 20
4.2.16. The "metalink:url" Element . . . . . . . . . . . . . . 20
4.2.17. The "metalink:version" Element . . . . . . . . . . . . 21
5. Extending Metalink . . . . . . . . . . . . . . . . . . . . . . 21
5.1. Extensions from Non-Metalink Vocabularies . . . . . . . . 21
5.2. Extensions to the Metalink Vocabulary . . . . . . . . . . 21
5.3. Processing Foreign Markup . . . . . . . . . . . . . . . . 22
5.4. Extension Elements . . . . . . . . . . . . . . . . . . . . 22
5.4.1. Simple Extension Elements . . . . . . . . . . . . . . 22
5.4.2. Structured Extension Elements . . . . . . . . . . . . 23
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23
6.1. XML Namespace Registration . . . . . . . . . . . . . . . . 23
6.2. application/metalink4+xml MIME type . . . . . . . . . . . 23
7. Security Considerations . . . . . . . . . . . . . . . . . . . 24
7.1. Digital Signatures . . . . . . . . . . . . . . . . . . . . 25
7.2. URIs and IRIs . . . . . . . . . . . . . . . . . . . . . . 26
7.3. Spoofing . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.4. Cryptographic Hashes . . . . . . . . . . . . . . . . . . . 26
8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.1. Normative References . . . . . . . . . . . . . . . . . . . 27
8.2. Informative References . . . . . . . . . . . . . . . . . . 28
Appendix A. Acknowledgements and Contributors . . . . . . . . . . 30
Appendix B. RELAX NG Compact Schema . . . . . . . . . . . . . . . 31
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1. Introduction โจ
okay so Metalink is a document format built on Extensible Markup Language (XML) ๐ It describes a file, or a list of files, that you can download from a server. A Metalink can list a bunch of files, and each one comes with an extensible set of attached metadata. Each listed file can have a description, multiple cryptographic hashes, and a list of Uniform Resource Identifiers (URIs) where it's available ๐
here's the vibe: identical copies of a file are often sitting in lots of places across the Internet, over protocols like File Transfer Protocol (FTP), Hypertext Transfer Protocol (HTTP), and Peer-to-Peer (P2P) ๐ฆ Sometimes users get a list of these download locations (mirror servers) and have to pick one by hand based on geography, priority, or bandwidth. That's done to spread the load across servers and to let humans pick the spot they think will work best for them ๐
but ngl the problem is that individual servers can be slow, outdated, or unreachable, and you can't tell until the download has already started ๐ญ So the user cancels and has to restart. Transmission errors during a download can also corrupt the file, and there's no easy way to fix those ๐ For big downloads this is especially painful. All of it is frustrating for users and wastes bandwidth on retransmission ๐
knowledge about a download's availability on mirror servers can be gathered and kept up to date by the origin server operators or by a third party ๐ง That knowledge, together with cryptographic hashes, digital signatures, and more, can be stored in a machine-readable Metalink file. The Metalink file passes all of that to the user agent, which can read it automatically or show the info to a human ๐ User agents can fall back to alternate mirrors if the current one has an issue. So clients can work their way to a successful download even when conditions are rough ๐ All of this happens transparently to the human, and the download ends up way more reliable and efficient ๐ฅ
compare that to a traditional HTTP redirect to one mirror. That only carries a little info, a referral to a single server, and HTTP has no provision for handling failures ๐
some clients also do multi-source downloads, where chunks of a file come from multiple mirrors (and optionally P2P) at the same time. That often makes the download faster โญ Metalinks can combine HTTP, FTP, and P2P together, because no matter which protocol the Metalink was obtained over, it can make a resource reachable through the other protocols ๐ซถ If the Metalink came from a trusted source, its verification metadata can solve trust problems when you download from replica servers run by third parties ๐ Metalinks also carry structured info about downloads that search engines can index ๐ธ
1.1. Examples
here's a brief Metalink Document that describes a single file ๐
<?xml version="1.0" encoding="UTF-8"?>
<metalink xmlns="urn:ietf:params:xml:ns:metalink">
<file name="example.ext">
<size>14471447</size>
<url>ftp://ftp.example.com/example.ext</url>
<url>http://example.com/example.ext</url>
<metaurl mediatype="torrent">
http://example.com/example.ext.torrent</metaurl>
</file>
</metalink>
and here's a more extensive Metalink Document that describes two files ๐
<?xml version="1.0" encoding="UTF-8"?>
<metalink xmlns="urn:ietf:params:xml:ns:metalink">
<published>2009-05-15T12:23:23Z</published>
<file name="example.ext">
<size>14471447</size>
<identity>Example</identity>
<version>1.0</version>
<language>en</language>
<description>
A description of the example file for download.
</description>
<hash type="sha-256">f0ad929cd259957e160ea442eb80986b5f01...</hash>
<url location="de"
priority="1">ftp://ftp.example.com/example.ext</url>
<url location="fr"
priority="1">http://example.com/example.ext</url>
<metaurl mediatype="torrent"
priority="2">http://example.com/example.ext.torrent</metaurl>
</file>
<file name="example2.ext">
<size>14471447</size>
<identity>Example2</identity>
<version>1.0</version>
<language>en</language>
<description>
Another description for a second file.
</description>
<hash type="sha-256">2f548ce50c459a0270e85a7d63b2383c5523...</hash>
<url location="de"
priority="1">ftp://ftp.example.com/example2.ext</url>
<url location="fr"
priority="1">http://example.com/example2.ext</url>
<metaurl mediatype="torrent"
priority="2">http://example.com/example2.ext.torrent</metaurl>
</file>
</metalink>
1.2. Namespace and Version
the XML Namespaces URI [REC-xml-names] for the XML data format in this spec is ๐
urn:ietf:params:xml:ns:metalink
for convenience, this data format can be called "Metalink", and that's the name this spec uses internally ๐ฆ
Part 1 of 6 is done, bestie. Part 2 is coming up next ๐
1.3. Notational Conventions ๐
okay so this part is all about the rules of the road ๐ฃ๏ธ first up, the spec is about what conformance means for Metalink Documents, and it also puts some requirements on Metalink Processors (the software reading these files) ๐
the namespace prefix "metalink:" is used for the Namespace URI from Section 1.2, above ๐ the prefix itself is totally arbitrary, so you could pick any other one and it wouldn't change the meaning ๐
metalink is written using terms from the XML Infoset [REC-xml-infoset] ๐ง to keep things short, the phrase "Information Item" gets dropped. so when this spec says "element," it means an Element Information Item, and "attribute" means an Attribute Information Item ๐
some sections come with a little RELAX NG Compact schema fragment [RELAX-NG] ๐ธ those fragments are NOT normative, meaning the actual words in the text are what define conformance โจ the full schema lives in Appendix B ๐ฆ
now the important bit ๐ซถ the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document get interpreted as described in BCP 14, [RFC2119], scoped to those conformance targets ๐ฅ
2. Metalink Documents ๐
this section is about Metalink Documents themselves ๐ a Metalink Document describes a file or a group of files, how to get them, and the metadata that identifies them ๐ its root is the metalink:metalink element ๐
namespace metalink = "urn:ietf:params:xml:ns:metalink"
start = metalinkMetalink
these are serialized as XML 1.0 [REC-xml] and labelled with the "application/metalink4+xml" media type ๐ฆ
Metalink Documents MUST be well-formed XML ๐ this spec does not define a Document Type Definition (DTD), so it doesn't require them to be valid in the XML sense either โจ
Metalink lets you use Internationalized Resource Identifiers (IRIs), encoded according to [RFC3987] ๐ธ every URI [RFC3986] is also an IRI, so a URI can go anywhere an IRI is named below ๐ one special thing though: when an IRI that is NOT also a URI gets used for dereferencing, it MUST be mapped to a URI using the steps in Section 3.1 of [RFC3987] ๐ญ
any element defined here MAY have an xml:lang attribute ๐ its content says what natural language the element (and its descendants) is in ๐ the language context only matters for elements and attributes this spec declares "Language-Sensitive" ๐ง the rules for xml:lang live in XML 1.0 [REC-xml], Section 2.12 ๐ซถ
metalinkCommonAttributes =
attribute xml:lang { metalinkLanguageTag }?,
undefinedAttribute*
all leading and trailing whitespace is part of the element content and MUST NOT be ignored ๐ โโ๏ธ so it's disallowed for elements whose type doesn't allow whitespace, like dates, integers, or IRIs ๐ some XML-generating tools sneakily add whitespace around values by default, and those tools will spit out invalid Metalink Documents ๐ญ
Metalink Documents that don't follow this spec are invalid and SHOULD NOT be used by Metalink Processors ๐
Metalink is extensible โจ see Section 5 of this document for the full scoop on how to extend Metalink Documents ๐ฆ
3. Common Metalink Constructs ๐ง
lots of Metalink elements share the same structures ๐ this section defines those shared structures so the element definitions can just point back here ๐ when an element is said to be a particular kind of construct, it inherits the requirements from that construct's definition in this section ๐
3.1. Text Constructs ๐ฌ
a Text construct holds human-readable text, usually pretty short ๐ธ
metalinkTextConstruct =
metalinkCommonAttributes,
text
for example, a metalink:description with text content:
...
<description>
A description of the example file for download.
</description>
...
the content of a Text construct MUST NOT contain child elements ๐ โโ๏ธ this text is meant to be shown to humans, so whitespace can be collapsed (including line breaks), and it can be displayed with fancy typography like justification and proportional fonts ๐
3.2. Date Constructs ๐
a Date construct is an element whose content MUST conform to the "date-time" production in [RFC3339] ๐ฐ๏ธ on top of that, an uppercase "T" MUST be used to separate the date and time, and an uppercase "Z" MUST be present when there's no numeric time zone offset ๐ซถ
metalinkDateConstruct =
metalinkCommonAttributes,
xsd:dateTime
these date values happen to be compatible with [ISO.8601.1988], [NOTE-datetime-19980827], and [REC-xmlschema-2-20041028] ๐
example Date constructs:
...
<updated>2010-05-01T12:15:02Z</updated>
...
<updated>2010-05-01T12:15:02.25Z</updated>
...
<updated>2010-05-01T12:15:02+01:00</updated>
...
<updated>2010-05-01T12:15:02.25+01:00</updated>
...
4. Metalink Element Definitions ๐
4.1. Container Elements ๐๏ธ
4.1.1. The "metalink:metalink" Element ๐
the "metalink:metalink" element is the document (aka top-level) element of a Metalink Document ๐ it's a container for the metadata and data tied to the listed files ๐ it contains one or more metalink:file child elements, which are made of Metadata elements ๐ง
metalinkMetalink =
element metalink:metalink {
metalinkCommonAttributes,
(metalinkFile+
& metalinkGenerator?
& metalinkOrigin?
& metalinkPublished?
& metalinkUpdated?
& extensionElement*)
}
these are the child elements this spec defines (heads up, some of them are required ๐):
- metalink:metalink elements MUST contain one or more metalink:file elements.
- metalink:metalink elements MAY contain exactly one metalink:generator element and MUST NOT contain more than one such element.
- metalink:metalink elements SHOULD contain exactly one metalink:origin element and MUST NOT contain more than one such element.
- metalink:metalink elements MAY contain exactly one metalink:published element and MUST NOT contain more than one such element.
- metalink:metalink elements MAY contain exactly one metalink:updated element and MUST NOT contain more than one such element.
4.1.1.1. Providing Textual Content ๐
downloads with textual content are generally more useful than ones without ๐ฅฐ some apps (full-text indexers, for example) need a minimum amount of text to work reliably and predictably ๐ Metalink publishers should keep this in mind ๐ซถ it is RECOMMENDED that each metalink:file element contain a non-empty metalink:description element, a non-empty metalink:identity element, a non-empty metalink:version element, and a non-empty metalink:publisher element when these elements are present ๐ธ but the absence of metalink:description, metalink:identity, metalink:version, and metalink:publisher is NOT an error, and Metalink Processors MUST NOT fail to function correctly because of such an absence ๐
4.1.2. The "metalink:file" Element ๐
the "metalink:file" element represents one individual file, acting as a container for the metadata and data tied to it ๐ฆ each unique file described in a Metalink Document MUST have its own metalink:file element ๐
all metalink:url elements inside each metalink:file element SHOULD lead to identical files ๐ง so each metalink:url should be an alternative location for the same file, and each metalink:metaurl should provide metadata for retrieving that same file another way, like over a Peer-to-Peer network ๐ซถ see Sections 4.2.8 and 4.2.16 for more ๐
metalinkFile =
element metalink:file {
metalinkCommonAttributes,
attribute name { text },
(metalinkCopyright?
& metalinkDescription?
& metalinkHash*
& metalinkIdentity?
& metalinkLanguage*
& metalinkLogo?
& metalinkMetaURL*
& metalinkOS*
& metalinkPieces*
& metalinkPublisher?
& metalinkSignature?
& metalinkSize?
& metalinkURL*
& metalinkVersion?
& extensionElement*)
}
this spec gives no meaning to the order of metalink:file elements, or to the order of metalink:url or metalink:metaurl elements ๐ what matters is the value of the "priority" attribute on metalink:url or metalink:metaurl elements โจ
the following child elements are defined here (and some of them are required ๐):
- metalink:file elements MAY contain exactly one metalink:copyright element and MUST NOT contain more than one such element.
- metalink:file elements MAY contain exactly one metalink:description element and MUST NOT contain more than one such element.
- metalink:file elements MAY contain exactly one metalink:identity element and MUST NOT contain more than one such element.
- metalink:file elements MAY contain one or more metalink:hash elements.
- metalink:file elements MAY contain one or more metalink:language elements.
- metalink:file elements MAY contain exactly one metalink:logo element and MUST NOT contain more than one such element.
- metalink:file elements MAY contain one or more metalink:os element.
- metalink:file elements MUST contain at least one metalink:url element or at least one metalink:metaurl element. Typically, metalink:file elements contain more than one metalink:url element to provide multiple download sources.
- metalink:file elements MAY contain one or more metalink:pieces elements.
- metalink:file elements MAY contain exactly one metalink:publisher element and MUST NOT contain more than one such element.
- metalink:file elements MAY contain one or more metalink:signature elements.
- metalink:file elements SHOULD contain exactly one metalink:size element and MUST NOT contain more than one such element.
- metalink:file elements MAY contain exactly one metalink:version element and MUST NOT contain more than one such element.
4.1.2.1. The "name" Attribute ๐ท๏ธ
metalink:file elements MUST have a "name" attribute ๐ it holds the local file name the downloaded file gets written to ๐ง so if a Metalink Document has multiple metalink:file elements, the value of "name" MUST be unique for each one ๐ซถ
directory info can also be included in a "path/file" format only, like this:
<file name="debian-amd64/sarge/Contents-amd64.gz">
in this example, a subdirectory "debian-amd64/sarge/" will be created and a file named "Contents-amd64.gz" will be created inside it ๐ฆ
Security Note: The path MUST NOT contain any directory traversal directives or information. The path MUST be relative. The path MUST NOT begin with a "/", "./", or "../"; contain "/../"; or end with "/.." ๐จ๐ this one is seriously important bestie, so please don't skip it ๐ญ๐ฅ
4.1.3. The "metalink:pieces" Element ๐งฉ
okay so the "metalink:pieces" element is a container that holds a list of cryptographic hashes ๐ each hash covers one contiguous, non-overlapping piece of the file. The hashes MUST be listed in the same order the pieces appear in the file, starting from the very beginning. Metalink Documents MAY contain one or multiple metalink:pieces container elements, as long as each "type" attribute has a unique value ๐
metalinkPieces =
element metalink:pieces {
attribute length { xsd:positiveInteger },
attribute type { text },
metalinkHash+
}
4.1.3.1. The "type" Attribute ๐ท๏ธ
metalink:pieces elements MUST have a "type" attribute.
The IANA registry called "Hash Function Textual Names" is where the hash type values live ๐ฆ Check out Section 7.4 for the security implications, because they matter ๐ญ
4.1.3.2. The "length" Attribute ๐
metalink:pieces elements MUST have a "length" attribute. It's a positive integer that tells you how long each piece is, measured in octets โจ The whole file gets chopped into non-overlapping pieces of this length, starting from the beginning. So every piece MUST be the same size, except the last one, which is just whatever's left over ๐ธ That last piece runs to the end of the file, so it MAY be shorter than the rest. It's giving "leftovers" energy ๐
4.2. Metadata Elements ๐
4.2.1. The "metalink:copyright" Element ยฉ๏ธ
The "metalink:copyright" element is a Text construct that carries a human-readable copyright for a file ๐ It is Language-Sensitive.
metalinkCopyright =
element metalink:copyright {
metalinkTextConstruct
}
4.2.2. The "metalink:description" Element ๐
The "metalink:description" element is a Text construct with a human-readable description of the file ๐ง It is Language-Sensitive.
metalinkDescription =
element metalink:description {
metalinkTextConstruct
}
4.2.3. The "metalink:generator" Element ๐ค
The "metalink:generator" element's content names the generating agent and its version, which is used to create a Metalink Document. It's there for debugging and other purposes ๐
metalinkGenerator =
element metalink:generator {
metalinkTextConstruct
}
The content of metalink:generator is defined below in ABNF notation [RFC5234].
token = 1*<any CHAR except CTLs or separators>
separators = "(" / ")" / "<" / ">" / "@"
/ "," / ";" / ":" / "\" / DQUOTE
/ "/" / "[" / "]" / "?" / "="
/ "{" / "}" / SP / HTAB
agent = token ["/" agent-version]
agent-version = token
Examples:
...
<generator>MirrorBrain/2.11</generator>
...
<generator>MirrorManager/1.2.11</generator>
...
<generator>metalinktools/0.3.6</generator>
...
<generator>MetalinkEditor/1.2.0</generator>
...
Okay, so any token character MAY show up in an agent-version ๐ซถ But this token SHOULD only ever be used as a version identifier. Successive versions of the same agent SHOULD only differ in the agent-version part of the agent value ๐
4.2.4. The "metalink:hash" Element ๐
The "metalink:hash" element is a Text construct that carries a cryptographic hash for a file ๐ All hashes are encoded in lowercase hexadecimal. Hashes are used to verify the integrity of a complete file or a portion of one, so you can tell whether it arrived without any errors ๐
metalinkHash =
element metalink:hash {
attribute type { text }?,
text
}
Metalink Documents MAY contain one or multiples hashes of a complete file. metalink:hash elements with a "type" attribute MUST contain a hash of the complete file. In this example, both SHA-1 and SHA-256 hashes of the complete file are included โจ
...
<hash type="sha-1">a97fcf6ba9358f8a6f62beee4421863d3e52b080</hash>
<hash type="sha-256">fc87941af7fd7f03e53b34af393f4c14923d74...</hash>
...
Metalink Documents MAY also contain hashes for individual pieces of a file ๐งฉ metalink:hash elements inside a metalink:pieces container element hold a hash for that specific piece or chunk of the file. They are the same hash type as the metalink:pieces element they live in. Metalink Documents MAY contain one or multiple metalink:pieces container elements, as long as each "type" attribute of metalink:pieces has a unique value.
metalink:hash elements without a "type" attribute MUST contain a hash for that specific piece or chunk of the file. They MUST be listed in the same order the pieces appear in the file, starting from the beginning. The size of each piece equals the value of the "length" attribute of the metalink:pieces element, except for the last piece, which is the remainder ๐ See Section 4.1.3.2 for more on piece sizes.
In this example, SHA-1 and SHA-256 hashes of the complete file are included, along with four SHA-1 piece hashes ๐
...
<hash type="sha-1">a97fcf6ba9358f8a6f62beee4421863d3e52b080</hash>
<hash type="sha-256">fc87941af7fd7f03e53b34af393f4c14923d74...</hash>
<pieces length="1048576" type="sha-1">
<hash>d96b9a4b92a899c2099b7b31bddb5ca423bb9b30</hash>
<hash>10d68f4b1119014c123da2a0a6baf5c8a6d5ba1e</hash>
<hash>3e84219096435c34e092b17b70a011771c52d87a</hash>
<hash>67183e4c3ab892d3ebe8326b7d79eb62d077f487</hash>
</pieces>
...
4.2.4.1. The "type" Attribute ๐ฏ
metalink:hash elements MUST have a "type" attribute if and only if they contain a hash of the complete file. The IANA registry named "Hash Function Textual Names" defines the hash type values. metalink:hash elements MUST NOT have a "type" attribute if they are inside a metalink:pieces container element. See Section 7.4 for security implications, and seriously don't skip it ๐
4.2.5. The "metalink:identity" Element ๐ชช
The "metalink:identity" element is a Text construct that carries a human-readable identity for a file. For example, the identity of Firefox 3.5 would be "Firefox" ๐ฆ
metalinkIdentity =
element metalink:identity {
metalinkTextConstruct
}
4.2.6. The "metalink:language" Element ๐
The "metalink:language" element is a Text construct that carries a language code for a file, per [RFC5646] ๐ฃ๏ธ
Multiple metalink:language elements are allowed. That makes sense for things like a binary installer that offers several language options, a movie with multiple language tracks, or a document written in several languages ๐ฌ
metalinkLanguage =
element metalink:language {
metalinkTextConstruct
}
4.2.7. The "metalink:logo" Element ๐ผ๏ธ
The "metalink:logo" element's content is an IRI reference [RFC3987] pointing to an image that visually identifies a file โจ
metalinkLogo =
element metalink:logo {
metalinkCommonAttributes,
(metalinkUri)
}
The image SHOULD have an aspect ratio of one (horizontal) to one (vertical), and SHOULD be suitable for presentation at a small size ๐
4.2.8. The "metalink:metaurl" Element ๐งฒ
The "metalink:metaurl" element contains the IRI of a metadata file, also known as a metainfo file, about a resource you want to download. For example, this could be the IRI of a BitTorrent .torrent file, a Metalink Document, or some other kind of metadata file ๐ฆ Note that the information in the metalink:hash element does not apply to these metadata files. It applies to the files that they describe ๐ซถ
metalinkMetaURL =
element metalink:metaurl {
metalinkCommonAttributes,
attribute priority { xsd:positiveInteger {
maxInclusive = "999999"}}?,
attribute mediatype { text },
attribute name { text }?,
(metalinkUri)
}
4.2.8.1. The "priority" Attribute ๐ฅ
metalink:metaurl elements MAY have a priority attribute. Values MUST be positive integers between 1 and 999999. Lower values mean higher priority ๐ metalink:metaurl elements without a priority attribute are considered to have the lowest priority, which is 999999. The priority values of metalink:metaurl and metalink:url elements get compared, and the ones with the lowest values, starting with 1, are used first. Multiple metalink:metaurl and metalink:url elements MAY have the same priority. For instance, one BitTorrent .torrent file and three FTP URIs could all have priority="1" ๐ See also the "priority" attribute of the metalink:url element.
4.2.8.2. The "mediatype" Attribute ๐
metalink:metaurl elements MUST have a "mediatype" attribute. It indicates the Multipurpose Internet Mail Extensions (MIME) media type [RFC4288] of the metadata file at the IRI. For BitTorrent, as specified in [BITTORRENT], the value "torrent" is REQUIRED. Types without "/" are reserved, and right now "torrent" is the only reserved value ๐ง
Values for this attribute are defined below in ABNF notation [RFC5234].
media-type = (type-name "/" subtype-name) / media-reserved
media-reserved = "torrent"
type-name = <Defined in Section 4.2 of RFC 4288>
subtype-name = <Defined in Section 4.2 of RFC 4288>
4.2.8.3. The "name" Attribute ๐๏ธ
metalink:metaurl elements MAY have a "name" attribute. It indicates a specific file inside a BitTorrent .torrent file, or a Metalink Document that describes multiple files ๐
Directory information can also be contained in a "path/file" format only, like this:
<metaurl
mediatype="torrent" name="debian-amd64/sarge/Contents-amd64.gz">
In this example, a file named "Contents-amd64.gz" is indicated, inside a "debian-amd64/sarge/" subdirectory ๐ธ The path MUST NOT contain any directory traversal directives or information. The path MUST be relative. The path MUST NOT begin with a "/", "./", or "../"; MUST NOT contain "/../"; and MUST NOT end with "/..". No sneaky traversal allowed, bestie ๐ โโ๏ธ
4.2.9. The "metalink:origin" Element ๐
The "metalink:origin" element is an IRI where the Metalink Document was originally published. If the dynamic attribute of metalink:origin is "true", then updated versions of the Metalink can be found at this IRI ๐
metalinkOrigin =
element metalink:origin {
metalinkCommonAttributes,
attribute dynamic { xsd:boolean }?,
(metalinkUri)
}
4.2.9.1. The "dynamic" Attribute โก
The metalink:origin element MAY have a "dynamic" attribute, set to "true" or "false". It tells you whether a Metalink at the origin IRI will contain dynamic, updated information, or whether it's static and not likely to change ๐ฆ
4.2.10. The "metalink:os" Element ๐ป
The "metalink:os" element is a Text construct that conveys an Operating System that a file is suitable for. The IANA registry named "Operating System Names" defines the OS type values ๐ฅ๏ธ
metalinkOS =
element metalink:os {
metalinkTextConstruct
}
4.2.11. The "metalink:published" Element ๐
The "metalink:published" element is a Date construct for an instant in time tied to an event early in the life cycle of the entry ๐ผ
metalinkPublished =
element metalink:published {
metalinkDateConstruct
}
Typically, metalink:published is associated with the initial creation or first availability of the resource โจ The metalink:updated element is used when a Metalink Document has been updated after its initial publication ๐
4.2.12. The "metalink:publisher" Element ๐
okay bestie, the "metalink:publisher" element is the one that tells everyone who published the file described in the Metalink Document ๐ it holds a human-readable group or other entity name, plus an IRI for more info. main character publisher energy โจ
metalinkPublisher =
element metalink:publisher {
metalinkCommonAttributes,
attribute name { text },
attribute url { metalinkUri }?
}
4.2.12.1. The "name" Attribute ๐
the metalink:publisher element MUST have a "name" attribute that gives the human-readable name of the publisher. no skipping this one, it's giving required ๐ญ
4.2.12.2. The "url" Attribute ๐ฆ
the metalink:publisher element MAY have a "url" attribute, and its value MUST be an IRI reference [RFC3987]. optional but iconic when it shows up ๐ธ
4.2.13. The "metalink:signature" Element ๐
the "metalink:signature" element is a Text construct that carries a digital signature for a file described in a Metalink Document. digital signatures verify that a file is from the entity that signed it, so it's a whole vibe ๐
Support in Metalink Processors for digital signatures included in this element is OPTIONAL. quick note, signing the Metalink Documents themselves (as opposed to signing the files they describe) is covered in Section 7.1 โจ
metalinkSignature =
element metalink:signature {
attribute mediatype { text },
metalinkTextConstruct
}
example with an OpenPGP signature [RFC4880] ๐ง
<signature mediatype="application/pgp-signature">
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEABECAAYFAkrxdXQACgkQeOEcayedXJHqFwCfd1p/HhRf/iDvYhvFbTrQPz+p
p3oAoO9lKHoOqOE0EMB3zmMcLoYUrNkg
=ggAf
-----END PGP SIGNATURE-----
</signature>
4.2.13.1. The "mediatype" Attribute ๐
metalink:signature elements MUST have a "mediatype" attribute that indicates the MIME media type [RFC4288] of the included digital signature. the values for this attribute are defined below in ABNF notation [RFC5234], so get ready for some grammar โจ
media-type = type-name "/" subtype-name
type-name = <Defined in Section 4.2 of RFC 4288>
subtype-name = <Defined in Section 4.2 of RFC 4288>
4.2.14. The "metalink:size" Element ๐
the "metalink:size" element indicates the length of the linked content in octets. this is the content length of the representation returned when the IRI is mapped to a URI and dereferenced. note that the "metalink:size" element MUST override the actual content length of the representation as reported by the underlying protocol, and any that don't match MUST be discarded by Metalink Processors. this value MUST be a non-negative integer ๐ฅ
metalinkSize =
element metalink:size {
xsd:nonNegativeInteger
}
4.2.15. The "metalink:updated" Element ๐ฐ๏ธ
the "metalink:updated" element is a Date construct showing the most recent moment a Metalink was changed in a way the publisher considers significant. so not every edit will bump it, bestie ๐
metalinkUpdated =
element metalink:updated {
metalinkDateConstruct
}
Publishers MAY change the value of this element over time.
4.2.16. The "metalink:url" Element ๐
the "metalink:url" element contains a file IRI. most metalink:file container elements will have multiple metalink:url elements, and each one SHOULD be a valid alternative to download the same file ๐ฆ
the metalink:url elements SHOULD be resolvable and, if they are resolvable, SHOULD lead to identical files. so they should all match, periodt ๐
Metalink Processors MUST filter out invalid files obtained from "metalink:url" elements by using information in the metalink:size element and metalink:hash elements. no sketchy files get through ๐ก๏ธ
metalinkURL =
element metalink:url {
metalinkCommonAttributes,
attribute location { xsd:string {
minLength = "2" maxLength="2"}
}?,
attribute priority { xsd:positiveInteger {
maxInclusive = "999999"}}?,
(metalinkUri)
}
4.2.16.1. The "priority" Attribute ๐
metalink:url elements MAY have a priority attribute. values MUST be positive integers between 1 and 999999. lower values mean higher priority ๐ metalink:url elements without a priority attribute are considered to have the lowest priority, i.e., 999999, so they're basically the background characters. multiple metalink:url elements can share the same priority, like ten different mirrors all with priority="1" (very cute, very fair) ๐ฐ
4.2.16.2. The "location" Attribute ๐
metalink:url elements MAY have a "location" attribute, which is a [ISO3166-1] alpha-2 two letter country code for the geographical location of the physical server an IRI is used to access ๐บ๏ธ
4.2.17. The "metalink:version" Element ๐ท๏ธ
the "metalink:version" element is a Text construct that carries a human-readable version for a file. like, the version of Firefox 3.5 would be "3.5" โจ
metalinkVersion =
element metalink:version {
metalinkTextConstruct
}
5. Extending Metalink ๐ธ
5.1. Extensions from Non-Metalink Vocabularies ๐งฉ
this specification describes Metalink's XML vocabulary, so that's the scope ๐
5.2. Extensions to the Metalink Vocabulary ๐ฎ
the Metalink namespace is reserved for future forward-compatible revisions of Metalink. future versions of this spec could add new elements and attributes to the Metalink markup vocabulary, so it's future-proof and extra ๐ง
software written to conform to this version of the specification won't be able to process that markup correctly. honestly, it also won't be able to tell it apart from markup error ๐ญ for the purposes of this discussion, unrecognized markup from the Metalink vocabulary is called "foreign markup".
5.3. Processing Foreign Markup ๐ซถ
Metalink Processors that run into foreign markup in a location that is legal according to this specification MUST ignore that foreign markup. in particular, they MUST NOT stop processing or signal an error. the processor might be able to handle the foreign markup correctly, and if so, it does. otherwise, that markup is called "unknown foreign markup" ๐คทโโ๏ธ
when unknown foreign markup shows up as a child of metalink:file or metalink:metalink, Metalink Processors MAY bypass the markup and any textual content, and MUST NOT change their behavior because the markup is there ๐
5.4. Extension Elements ๐
Metalink allows foreign markup anywhere in a Metalink document, except where it's explicitly forbidden. child elements of metalink:file and metalink:metalink are considered Metadata elements, and they're described below. the role of any other foreign markup is undefined by this specification ๐ซง
5.4.1. Simple Extension Elements ๐
a Simple Extension element MUST NOT have any attributes or child elements. it MAY contain character data, or it MAY be empty. Simple Extension elements are not Language-Sensitive ๐ท
simpleExtensionElement =
element * - metalink:* {
text
}
the element can be interpreted as a simple property (or name/value pair) of the parent element that encloses it. the pair made of the element's namespace URI and its local name can be interpreted as the name of the property. the character data content of the element can be interpreted as the value of the property. if the element is empty, the property value can be interpreted as an empty string ๐
5.4.2. Structured Extension Elements ๐ง
the root element of a Structured Extension element MUST have at least one attribute or child element. it MAY have attributes, it MAY contain well-formed XML content (including character data), or it MAY be empty. Structured Extension elements are Language-Sensitive ๐
structuredExtensionElement =
element * - metalink:* {
(attribute * { text }+,
(text|anyElement)*)
| (attribute * { text }*,
(text?, anyElement+, (text|anyElement)*))
}
the structure of a Structured Extension element, including the order of its child elements, could be significant ๐
this specification doesn't give an interpretation of a Structured Extension element. the syntax of the XML inside the element (and an interpretation of how the element relates to its containing element) is defined by the specification of the Metalink extension ๐
6. IANA Considerations ๐๏ธ
6.1. XML Namespace Registration ๐ชช
this document uses the XML registry specified in [RFC3688]. so IANA has made the following registration ๐
registration request for the Metalink namespace:
URI: urn:ietf:params:xml:ns:metalink
Registrant Contact: See the "Authors' Addresses" section of this
document.
XML: None. Namespace URIs do not represent an XML specification.
6.2. application/metalink4+xml MIME type ๐ฎ
a Metalink Document, when serialized as XML 1.0, can be identified with the following media type ๐
Type name: application
Subtype name: metalink4+xml
Required parameters: None.
optional parameters:
charset: this parameter has semantics identical to the charset parameter of the "application/xml" media type as specified in [RFC3023].
Encoding considerations: Identical to those of "application/xml" as
described in [RFC3023], Section 3.2.
Security considerations: As defined in this specification.
as this media type uses the "+xml" convention, it shares the same security considerations as described in [RFC3023], Section 10 ๐
Interoperability considerations: There are no known interoperability
issues.
Published specification: This specification.
Applications that use this media type: File transfer applications.
Additional information:
Magic number(s): None.
File extension: .meta4
Macintosh File Type code: TEXT
Person and email address to contact for further information:
Anthony Bryan <anthonybryan@gmail.com>
Intended usage: COMMON
Restrictions on usage: None.
Author: Anthony Bryan <anthonybryan@gmail.com>
Change controller: IESG
7. Security Considerations ๐ก๏ธ๐ญ
because Metalink is an XML-based format, existing XML security mechanisms can be used to secure its content ๐
publishers of Metalink Documents may have sound reasons for signing otherwise-unprotected content. for example, a merchant might digitally sign a Metalink that lists a file download to verify its origin. other merchants may want to sign and encrypt Metalink Documents that list digital songs that have been purchased. honestly, many other examples are conceivable ๐ถ
publishers are encouraged to offer Metalink documents via authenticated HTTP under Transport Layer Security (TLS) as specified in [RFC2818]. the choice of a secure content layer rests entirely with the content providers ๐ซก
publishers are also encouraged to include digital signatures of the files within the Metalink Documents, if they're available, as described in Section 4.2.13 โ๏ธ
normally, a publisher is in the best position to know how strong the protective signing ought to be on their content. so a publisher can choose weak or strong cryptography, and a Metalink Processor SHOULD normally accept that. there are potential applications where the Metalink Processor chooses to reject weak cryptography, but that isn't envisioned as the common use case. the publisher gets the final say, bestie ๐๐
7.1. Digital Signatures ๐
okay so the root of a Metalink Document (that's metalink:metalink) or any metalink:file element is allowed to carry an Enveloped Signature, as described by XML-Signature and Syntax Processing [REC-xmldsig-core]. ๐ฆ
Signing and verifying are both OPTIONAL, but if an implementation supports either one, it SHOULD implement RSA with a minimum key size of 2048 with SHA-256. ๐
Metalink Processors that do verify signatures MUST reject Metalink Documents with invalid signatures. โ
BUT (and this is the iconic part ๐ซถ) Metalink Processors MUST NOT reject a Metalink Document just because they can't verify its signature. They MUST continue processing, and they MAY tell the user that the validation failed. ๐ธ
In other words, seeing an element with the namespace URI http://www.w3.org/2000/09/xmldsig# and a local name of Signature as a child of the document element MUST NOT make a Metalink Processor fail, just because it's there. โจ
Other elements in a Metalink Document MUST NOT be signed, unless their definitions explicitly say they can be. ๐
Now, Section 6.5.1 of [REC-xmldsig-core] requires support for Canonical XML [REC-xml-c14n]. But ngl, lots of implementers skip it, because signed XML documents that are enclosed in other XML documents end up with broken signatures. ๐ So Metalink Processors that verify signed Metalink Documents MUST be able to canonicalize with the exclusive XML canonicalization method, identified by the URI http://www.w3.org/2001/10/xml-exc-c14n#, as specified in Exclusive XML Canonicalization [REC-xml-exc-c14n]. ๐ฅ
Section 4.4.2 of [REC-xmldsig-core] requires support for Digital Signature Algorithm (DSA) signatures and recommends support for RSA signatures. But RSA is way more popular in the market than DSA, so Metalink Processors that verify signed Metalink Documents MUST be able to verify RSA signatures, but they do not need to be able to verify DSA signatures. ๐ Also, because keying material for message authentication code (MAC) authentication can cause security issues if it isn't handled properly, Metalink Documents SHOULD NOT use MACs for signatures. ๐ซ
7.2. URIs and IRIs ๐
Metalink Processors handle URIs and IRIs, so go read Section 7 of [RFC3986] and Section 8 of [RFC3987] for the security considerations about how they get handled and used. ๐
7.3. Spoofing ๐ต๏ธโโ๏ธ
Spoofing attacks are a real vibe-killer here. An attacker can publish Metalink Documents full of false information. Malicious publishers can put inaccurate information anywhere in the document, and unaware downloaders could end up grabbing malicious or worthless content. ๐ญ They could even try a distributed denial-of-service attack by stuffing Metalink Documents with unrelated IRIs. ๐
Digital signatures are how we address spoofing. ๐
7.4. Cryptographic Hashes ๐ง
Right now, some of the hash types in the IANA registry named "Hash Function Textual Names" are considered insecure. That includes the whole Message Digest family of algorithms, which just aren't strong enough for cryptographically strong verification. ๐ โโ๏ธ Bad actors could hand over files that look identical to another file because of a collision, meaning the weak hashes of the intended file and a swapped-in malicious file could match. ๐ฑ
Metalink Generators and Processors MUST support "sha-256", which is SHA-256 as specified in [FIPS-180-3], and they MAY support stronger hashes too. ๐
If a Metalink Document contains hashes, it SHOULD include "sha-256", which is SHA-256, or something stronger. It MAY also include other hashes from the IANA registry named "Hash Function Textual Names". ๐
8. References ๐
8.1. Normative References ๐
- [BITTORRENT] Cohen, B., "The BitTorrent Protocol Specification", BITTORRENT 11031, February 2008,
<http://www.bittorrent.org/beps/bep_0003.html>. - [FIPS-180-3] National Institute of Standards and Technology (NIST), "Secure Hash Standard (SHS)", FIPS PUB 180-3, October 2008.
- [ISO3166-1] International Organization for Standardization, "ISO 3166-1:2006. Codes for the representation of names of countries and their subdivisions -- Part 1: Country codes", November 2006.
- [REC-xml] Yergeau, F., Paoli, J., Bray, T., Sperberg-McQueen, C., and E. Maler, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", W3C REC-xml-20081126, November 2008,
<http://www.w3.org/TR/2008/REC-xml-20081126/>. - [REC-xml-c14n] Boyer, J., "Canonical XML Version 1.0", W3C REC REC-xml-c14n-20010315, March 2001,
<http://www.w3.org/TR/2001/REC-xml-c14n-20010315>. - [REC-xml-exc-c14n] Eastlake, D., Boyer, J., and J. Reagle, "Exclusive XML Canonicalization Version 1.0", W3C REC REC-xml-exc-c14n-20020718, July 2002,
<http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/>. - [REC-xml-infoset] Cowan, J. and R. Tobin, "XML Information Set (Second Edition)", W3C REC-xml-infoset-20040204, February 2004,
<http://www.w3.org/TR/2004/REC-xml-infoset-20040204/>. - [REC-xml-names] Hollander, D., Bray, T., Tobin, R., and A. Layman, "Namespaces in XML 1.0 (Third Edition)", W3C REC-xml-names-20091208, December 2009,
<http://www.w3.org/TR/2009/REC-xml-names-20091208/>. - [REC-xmldsig-core] Solo, D., Reagle, J., and D. Eastlake, "XML-Signature Syntax and Processing (Second Edition)", W3C REC-xmldsig-core-20080610, June 2008,
<http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/>. - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
- [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media Types", RFC 3023, January 2001.
- [RFC3339] Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, July 2002.
- [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.
- [RFC3987] Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, January 2005.
- [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and Registration Procedures", BCP 13, RFC 4288, December 2005.
- [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, January 2008.
- [RFC5646] Phillips, A. and M. Davis, "Tags for Identifying Languages", BCP 47, RFC 5646, September 2009.
8.2. Informative References ๐ก
- [ISO.8601.1988] International Organization for Standardization, "Data elements and interchange formats - Information interchange - Representation of dates and times", ISO Standard 8601, June 1988.
- [NOTE-datetime-19980827] Wolf, M. and C. Wicksteed, "Date and Time Formats", W3C NOTE-datetime-19980827, August 1998,
<http://www.w3.org/TR/1998/NOTE-datetime-19980827>. - [REC-xmlschema-2-20041028] Malhotra, A. and P. Biron, "XML Schema Part 2: Datatypes Second Edition", W3C REC-xmlschema-2-20041028, October 2004,
<http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/>. - [RELAX-NG] Clark, J., "RELAX NG Compact Syntax", December 2001,
<http ://www.oasis-open.org/committees/relax-ng/compact-20021121.html>. - [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, January 2004.
- [RFC4287] Nottingham, M. and R. Sayre, "The Atom Syndication Format", RFC 4287, December 2005.
- [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. Thayer, "OpenPGP Message Format", RFC 4880, November 2007.
Appendix A. Acknowledgements and Contributors ๐ซง
The layout and shape of this document relies heavily on work pioneered in the Atom Syndication Format as specified in [RFC4287]. ๐ท
The content and concepts within are a product of the Metalink community. Key contributors provided early implementations: A. Bram Neijt, Hampus Wessman, Darius Liktorius, Manuel Subredu, Michael Burford, Giorgio Maone, Nils Maier, Max Velasques, Manolo Valdes, Hayden Legendre, Frederick Cheung, Rene Leonhardt, Per Oyvind Karlsen, Matt Domsch, Yazsoft, KGet developers, Free Download Manager developers, Orbit developers, Arne Babenhauserheide, Mathias Berchtold, Xienzhenyu and TheWorld Browser developers, Xi Software, Agostino Russo, and James Antill. ๐
The Metalink community has dozens of contributors who contributed to the evolution of Metalink or proposed ideas and wording for this document, including: Paul Burkhead, Kristian Weston, Nicolas Alvarez, Urs Wolfer, Bridget and Ethan Fletcher, Patrick Ruckstuhl, Sebastien Willemijns, Micah Cowan, Ruben Kerkhof, Danny Ayers, Nick Dominguez, Gary Zellerbach, James Clark, Daniel Stenberg, John and Sandra Sowder, Salvatore Musumeci, Steve Eshelman, Lucas Hewett, Ryan Cronin, Dave Winquist, Bob Denison, Wes Shelton, Josh Colbert, Steve Kleisath, Chad Neptune, Derick Cordoba, Nick Carrabba, Chris Carrabba, Erin Solari, Ryan Alexander, Tom Mainville, Janie Wargo, Jason Hansen, Tim Bray, Dan Brickley, Markus Hofmann, Dan Connolly, Tim Berners-Lee, Louis Suarez-Potts, Ross Smith, Jeff Covey, Ed Lee, Shawn Wilsher, Mike Connor, Johan Svedberg, Kees Cook, Dedric Carter, and Debi Goulding. We also thank the Anthony Family, the Bryan Family, Juanita Anthony, and Zimmy Bryan. ๐
Special thanks to Eran Hammer-Lahav, document shepherd, and Lisa Dusseault, Area Director. We also thank the following contributors for assistance and review: Mark Nottingham, Peter Saint-Andre, Julian Reschke, Chris Newman, Ian Macfarlane, Dave Cridland, Barry Leiba, Uri Blumenthal, Paul Hoffman, Felix Sasaki, Matthias Fuchs, Mark Baker, Scott Cantor, Brian Carpenter, Alexey Melnikov, Lars Eggert, Pasi Eronen, Tim Polk, Dan Romascanu, and Bjoern Hoehrmann. ๐
Peter Poeml wishes to acknowledge the support of SUSE Linux Products GmbH / Novell Inc., where he was employed during much of the work on this document. ๐ง
This document is dedicated to Sonora Bryan. ๐๐
Appendix B. RELAX NG Compact Schema โจ
Heads up, this appendix is informative ๐, so it's helpful context rather than a rule. The Relax NG schema explicitly excludes any elements in the Metalink namespace that aren't defined in this revision of the spec ๐ . If a Metalink Processor runs into that kind of markup, the requirements for how to handle it are in Sections 5.2 and 5.3 ๐.
# -*- rnc -*-
# RELAX NG Compact Syntax Grammar for the
# Metalink Format Specification Version 4
# Based on RFC 4287 schema
namespace local = ""
namespace metalink = "urn:ietf:params:xml:ns:metalink"
namespace xsd = "http://www.w3.org/2001/XMLSchema"
# Common attributes
metalinkCommonAttributes =
attribute xml:lang { metalinkLanguageTag }?,
undefinedAttribute*
# Text Constructs
metalinkTextConstruct =
metalinkCommonAttributes,
text
# Date Construct
metalinkDateConstruct =
metalinkCommonAttributes,
xsd:dateTime
start = metalinkMetalink
metalinkMetalink =
element metalink:metalink {
metalinkCommonAttributes,
(metalinkFile+
& metalinkGenerator?
& metalinkOrigin?
& metalinkPublished?
& metalinkUpdated?
& extensionElement*)
}
metalinkFile =
element metalink:file {
metalinkCommonAttributes,
attribute name { text },
(metalinkCopyright?
& metalinkDescription?
& metalinkHash*
& metalinkIdentity?
& metalinkLanguage*
& metalinkLogo?
& metalinkMetaURL*
& metalinkOS*
& metalinkPieces*
& metalinkPublisher?
& metalinkSignature?
& metalinkSize?
& metalinkURL*
& metalinkVersion?
& extensionElement*)
}
metalinkPieces =
element metalink:pieces {
attribute length { xsd:positiveInteger },
attribute type { text },
metalinkHash+
}
metalinkCopyright =
element metalink:copyright {
metalinkTextConstruct
}
metalinkDescription =
element metalink:description {
metalinkTextConstruct
}
metalinkGenerator =
element metalink:generator {
metalinkTextConstruct
}
metalinkHash =
element metalink:hash {
attribute type { text }?,
text
}
metalinkIdentity =
element metalink:identity {
metalinkTextConstruct
}
metalinkLanguage =
element metalink:language {
metalinkTextConstruct
}
metalinkLogo =
element metalink:logo {
metalinkCommonAttributes,
(metalinkUri)
}
metalinkMetaURL =
element metalink:metaurl {
metalinkCommonAttributes,
attribute priority { xsd:positiveInteger {
maxInclusive = "999999"}}?,
attribute mediatype { text },
attribute name { text }?,
(metalinkUri)
}
metalinkOrigin =
element metalink:origin {
metalinkCommonAttributes,
attribute dynamic { xsd:boolean }?,
(metalinkUri)
}
metalinkOS =
element metalink:os {
metalinkTextConstruct
}
metalinkPublished =
element metalink:published {
metalinkDateConstruct
}
metalinkPublisher =
element metalink:publisher {
metalinkCommonAttributes,
attribute name { text },
attribute url { metalinkUri }?
}
metalinkSignature =
element metalink:signature {
attribute mediatype { text },
metalinkTextConstruct
}
metalinkSize =
element metalink:size {
xsd:nonNegativeInteger
}
metalinkUpdated =
element metalink:updated {
metalinkDateConstruct
}
metalinkURL =
element metalink:url {
metalinkCommonAttributes,
attribute location { xsd:string {
minLength = "2" maxLength="2"}
}?,
attribute priority { xsd:positiveInteger {
maxInclusive = "999999"}}?,
(metalinkUri)
}
metalinkVersion =
element metalink:version {
metalinkTextConstruct
}
# As defined in RFC 3066 and compatible with RFC 5646
metalinkLanguageTag = xsd:string {
pattern = "[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*"
}
# Unconstrained; it's not entirely clear how IRI fit into
# xsd:anyURI so let's not try to constrain it here
metalinkUri = text
# Simple Extension
simpleExtensionElement =
element * - metalink:* {
text
}
# Structured Extension
structuredExtensionElement =
element * - metalink:* {
(attribute * { text }+,
(text|anyElement)*)
| (attribute * { text }*,
(text?, anyElement+, (text|anyElement)*))
}
# Other Extensibility
extensionElement =
simpleExtensionElement | structuredExtensionElement
undefinedAttribute =
attribute * - (xml:lang | local:*) { text }
undefinedContent = (text|anyForeignElement)*
anyElement =
element * {
(attribute * { text }
| text
| anyElement)*
}
anyForeignElement =
element * - metalink:* {
(attribute * { text }
| text
| anyElement)*
}
# EOF
Index ๐
A
ABNF
metalinkGenerator 13
metaurl mediatype 17
signature mediatype 19
application/metalink4+xml Media Type 23
C
copyright XML element 12
D
description XML element 13
F
file XML element 10
G
generator XML element 13
Grammar
metalinkCommonAttributes 7
metalinkCopyright 13
metalinkDateConstruct 8
metalinkDescription 13
metalinkFile 10
metalinkGenerator 13
metalinkHash 14
metalinkIdentity 15
metalinkLanguage 15
metalinkLogo 16
metalinkMetalink 8
metalinkMetaURL 16
metalinkOrigin 17
metalinkOS 18
metalinkPieces 12
metalinkPublished 18
metalinkPublisher 18
metalinkSignature 19
metalinkSize 20
metalinkTextConstruct 7
metalinkUpdated 20
metalinkURL 21
metalinkVersion 21
simpleExtensionElement 22
structuredExtensionElement 23
H
hash XML element 14
I
identity XML element 15
L
language XML element 15
logo XML element 16
M
Media Type
application/metalink4+xml 23
metalink XML element 8
metalinkCommonAttributes grammar production 7
metalinkCopyright grammar production 12
metalinkDateConstruct grammar production 8
metalinkDescription grammar production 13
metalinkFile grammar production 10
metalinkGenerator ABNF 13
metalinkGenerator grammar production 13
metalinkHash grammar production 14
metalinkIdentity grammar production 15
metalinkLanguage grammar production 15
metalinkLogo grammar production 16
metalinkMetalink grammar production 8
metalinkMetaURL grammar production 16
metalinkOrigin grammar production 17
metalinkOS grammar production 18
metalinkPieces grammar production 12
metalinkPublished grammar production 18
metalinkPublisher grammar production 18
metalinkSignature grammar production 19
metalinkSize grammar production 20
metalinkTextConstruct grammar production 7
metalinkUpdated grammar production 20
metalinkURL grammar production 21
metalinkVersion grammar production 21
metaurl mediatype ABNF 16
metaurl XML element 16
O
origin XML element 17
os XML element 18
P
pieces XML element 12
published XML element 18
publisher XML element 18
S
signature mediatype ABNF 19
signature XML element 19
simpleExtensionElement grammar production 22
size XML element 20
structuredExtensionElement grammar production 23
U
updated XML element 20
url XML element 20
V
version XML element 21
X
XML Elements
copyright 12
description 13
file 9
generator 13
hash 14
identity 15
language 15
logo 16
metalink 8
metaurl 16
origin 17
os 18
pieces 12
published 18
publisher 18
signature 19
size 20
updated 20
url 20
version 21
Authors' Addresses ๐
Anthony Bryan
Pompano Beach, FL
USA
EMail: anthonybryan@gmail.com
URI: http://www.metalinker.org
Tatsuhiro Tsujikawa
Shiga
Japan
EMail: tatsuhiro.t@gmail.com
URI: http://aria2.sourceforge.net
Neil McNab
San Diego, CA
USA
EMail: neil@nabber.org
URI: http://www.nabber.org
Dr. med. Peter Poeml
MirrorBrain
Venloer Str. 317
Koeln 50823
DE
Phone: +49 221 6778 333 8
EMail: peter@poeml.de
URI: http://mirrorbrain.org/~poeml/
๐ฆ where this page comes from
- ietf: rfc5854 2010-06
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms