RFC 5854

The Metalink Download Description Format

๐Ÿ“… published June 2010, from ietf

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 (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 ๐Ÿ”ฅ

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 ๐Ÿฆ‹

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.1. Container Elements ๐Ÿ—‚๏ธ

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 ๐Ÿ’–

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 ๐Ÿ˜ญ๐Ÿ”ฅ

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 ๐ŸŒˆ

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
   }

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
   }

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 ๐Ÿ‘‘

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 ๐Ÿ’€

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
   }

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
   }

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 ๐ŸŽ€

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 ๐Ÿ™…โ€โ™€๏ธ

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 ๐Ÿฆ‹

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
   }

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 ๐ŸŒŸ

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 ๐ŸŒธ

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>

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
   }

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.

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 ๐Ÿ—บ๏ธ

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
   }

this specification describes Metalink's XML vocabulary, so that's the scope ๐Ÿ’–

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