RFC 2387

The MIME Multipart/Related Content-type

๐Ÿ“… published August 1998, from ietf

okay bestie, let's get into RFC 2387 ๐Ÿฆ‹ It's called "The MIME Multipart/Related Content-type," written by E. Levinson in August 1998. It's a Standards Track document, which means it's an actual Internet standards protocol ๐Ÿ’… It obsoletes RFC 2112, so 2112 is retired and this one is the new official version. It's part of the Network Working Group series, and the title block also gives you the author, date, and status, so you know exactly what you're looking at ๐Ÿ’–

Status of This Memo

okay so this document specifies an Internet standards track protocol for the Internet community ๐ŸŒธ It also asks for discussion and suggestions for improvements, so the community is literally invited to weigh in ๐Ÿซถ If you want the current standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1). And the distribution of this memo is unlimited, so anyone can read it ๐ŸŒˆ

Copyright (C) The Internet Society (1998). All Rights Reserved. ๐Ÿ’œ

Abstract

the Multipart/Related content-type gives us one common way to represent objects that are made up of related MIME body parts ๐Ÿงš This document defines Multipart/Related and shows examples of how it gets used โœจ

1. Introduction โœจ

okay so several MIME applications need multiple body parts that only make sense when you look at them together ๐Ÿ‘€ Think MIME-PEM, MIME-Macintosh, and some other proposals ๐Ÿ“ The old way to handle these compound objects was to define a brand-new multipart subtype for every single object. That's a lot of subtypes, bestie ๐Ÿ˜ญ MIME is all about having one mechanism for the same goal across different purposes, so this document describes one single mechanism for these aggregate or compound objects ๐Ÿ’…

Multipart/Related is the MIME representation for compound objects ๐ŸŽ€ The object is categorized by a "type" parameter. There are additional parameters too: one points to a specific starting body part (the root), and others carry auxiliary information that might be needed when you unpack or process the object ๐Ÿ”ฅ

Multipart/Related MIME entities can contain Content-Disposition headers, which give suggestions for how a body part should be stored and displayed ๐Ÿ’– But Multipart/Related processing takes precedence over Content-Disposition, and section 4 explains how the two interact ๐Ÿ‘‘

Who handles displaying or processing a Multipart/Related's constituent entities? The application that handles the compound object ๐Ÿฆ‹ That's its job, not the protocol's ๐Ÿ’…

okay so this form is copied from RFC 1590, Appendix A ๐Ÿ“

To:  IANA@isi.edu
Subject:  Registration of new Media Type content-type/subtype

Media Type name:           Multipart

Media subtype name:        Related

Required parameters:       Type, a media type/subtype.

Optional parameters:       Start
                           Start-info

Encoding considerations:   Multipart content-types cannot have
                           encodings.

Security considerations:   Depends solely on the referenced type.

Published specification:   RFC-REL (this document).

Person & email address to contact for further information:
                           Edward Levinson
                           47 Clive Street
                           Metuchen, NJ  08840-1060
                           +1 908 494 1606
                           XIson@cnj.digex.net

3. Intended usage

the Multipart/Related media type is meant for compound objects made of several inter-related body parts ๐ŸŒธ For a Multipart/Related object, you can't get proper display by showing each constituent body part on its own, bestie ๐Ÿ™ˆ The content-type of the Multipart/Related object is specified by the type parameter. The "start" parameter, if it's given, points (through a content-ID) to the body part that contains the object root. If there's no start parameter, the default root is the first body part in the Multipart/Related body โœจ

What makes a compound object different from other object types is how its body parts relate to each other ๐Ÿงš Those relationships usually show up as links inside the object's components that reference the other components. In a single operating environment, those links are often file names. Inside a MIME message, those links may be represented using content-IDs or the value of some other "Content-" headers ๐Ÿ’œ

3.1. The Type Parameter

the type parameter must be specified, and its value is the MIME media type of the "root" body part ๐Ÿ’… That lets a MIME user agent figure out the content-type without having to look at the enclosed body part at all ๐Ÿฆ‹ If the value of the type parameter and the root body part's content-type differ, the User Agent's behavior is undefined ๐Ÿ™ƒ

3.2. The Start Parameter

the start parameter, if it's given, is the content-ID of the compound object's "root" ๐ŸŽ€ If it's not there, the "root" is the first body part in the Multipart/Related entity. The "root" is the element the applications process first, so it's kind of the main character ๐Ÿ‘‘

3.3. The Start-Info Parameter

start-info lets you give an application extra information ๐Ÿ“ It contains either a string or points (through a content-ID) to another MIME entity in the message. A typical use would be extra command line parameters, or a MIME entity with auxiliary information for processing the compound object ๐Ÿ”ฅ

applications that use Multipart/Related must specify how start-info gets interpreted. User Agents shall provide the parameter's value to the processing application ๐Ÿ’– Processes can tell a start-info reference apart from a token or quoted-string by checking the first non-white-space character: a < means it's a reference โœจ

3.4. Syntax

okay here's the grammar ๐Ÿค“

  related-param   := [ ";" "start" "=" cid ]
                     [ ";" "start-info"  "="
                        ( cid-list / value ) ]
                     [ ";" "type"  "=" type "/" subtype ]
                     ; order independent

  cid-list        := cid cid-list

  cid             := msg-id     ; c.f. [822]
  value           := token / quoted-string    ; c.f. [MIME]
                        ; value cannot begin with "<"

note that parameter values will usually need quoting ๐Ÿซถ Msg-id contains the special characters "<", ">", "@", and maybe other special characters. If msg-id contains quoted-strings, those quote marks must be escaped. Similarly, the type parameter contains the special character "/" so keep that in mind too ๐Ÿ’…

4. Handling Content-Disposition Headers

okay so Content-Disposition headers [DISP] suggest presentation styles for MIME body parts โœจ [DISP] describes two presentation styles, called the disposition types, INLINE and ATTACHMENT ๐Ÿฆ‹ Inside a multipart entity, these let the sender suggest presentation information. [DISP] also allows an optional storage (file) name ๐ŸŒธ Content-Disposition headers could show up in one or more body parts inside a Multipart/Related entity ๐Ÿงš

using Content-Disposition headers alongside Multipart/Related gives presentation info to User Agents that don't recognize Multipart/Related ๐Ÿ’– Those agents will treat the multipart as Multipart/Mixed, and they may find the Content-Disposition information useful ๐Ÿ™ˆ

With Multipart/Related, though, the application processing the compound object decides the presentation style for all the contained parts ๐Ÿ‘‘ In that context, the Content-Disposition header information is redundant or even misleading ๐Ÿ˜ญ So User Agents that understand Multipart/Related shall ignore the disposition type within a Multipart/Related body part ๐Ÿ’…

it might be possible for a User Agent that handles both Multipart/Related and Content-Disposition headers to pass the invoked application the Content-Disposition header's optional filename parameter, as a parameter to the Multipart/Related ๐ŸŽ€ How that info gets used depends on the specific application, and it should be specified when describing how the corresponding compound object gets handled. Those descriptions would fit well in an RFC that registers that object's media type ๐Ÿ”ฅ

5. Examples

5.1 Application/X-FixedRecord

the X-FixedRecord content-type is made of one or more octet-streams plus a list of the lengths of each record ๐ŸŒˆ The root lists the record lengths of each record within the streams. The record length list, type Application/X-FixedRecord, is a set of INTEGERs in ASCII format, one per line ๐Ÿ“ Each INTEGER gives the number of octets from the octet-stream body part that make up the next "record" ๐Ÿ’œ

here's an example that uses a single data block โœจ

  Content-Type: Multipart/Related; boundary=example-1
          start="<950120.aaCC@XIson.com>";
          type="Application/X-FixedRecord"
          start-info="-o ps"

  --example-1
  Content-Type: Application/X-FixedRecord
  Content-ID: <950120.aaCC@XIson.com>

  25
  10
  34
  10
  25
  21
  26
  10
  --example-1
  Content-Type: Application/octet-stream
  Content-Description: The fixed length records
  Content-Transfer-Encoding: base64
  Content-ID: <950120.aaCB@XIson.com>

  T2xkIE1hY0RvbmFsZCBoYWQgYSBmYXJtCkUgSS
  BFIEkgTwpBbmQgb24gaGlzIGZhcm0gaGUgaGFk
  IHNvbWUgZHVja3MKRSBJIEUgSSBPCldpdGggYS
  BxdWFjayBxdWFjayBoZXJlLAphIHF1YWNrIHF1
  YWNrIHRoZXJlLApldmVyeSB3aGVyZSBhIHF1YW
  NrIHF1YWNrCkUgSSBFIEkgTwo=

  --example-1--

5.2 Text/X-Okie

okay the Text/X-Okie is an invented markup language that lets you include images with text ๐ŸŽจ The cool thing in this example is that it includes two extra body parts, both pictures ๐Ÿ“ธ The encapsulated document refers to them internally through each picture's body part content-ID. Using "cid:", like this example does, might be useful for a bunch of different compound objects ๐Ÿ’– It's not part of the Multipart/Related specification though, so don't mix those up ๐Ÿ™ƒ

  Content-Type: Multipart/Related; boundary=example-2;
          start="<950118.AEBH@XIson.com>"
          type="Text/x-Okie"

  --example-2
  Content-Type: Text/x-Okie; charset=iso-8859-1;
          declaration="<950118.AEB0@XIson.com>"
  Content-ID: <950118.AEBH@XIson.com>
  Content-Description: Document

  {doc}
  This picture was taken by an automatic camera mounted ...
  {image file=cid:950118.AECB@XIson.com}
  {para}
  Now this is an enlargement of the area ...
  {image file=cid:950118:AFDH@XIson.com}
  {/doc}
  --example-2
  Content-Type: image/jpeg
  Content-ID: <950118.AFDH@XIson.com>
  Content-Transfer-Encoding: BASE64
  Content-Description: Picture A

  [encoded jpeg image]
  --example-2
  Content-Type: image/jpeg
  Content-ID: <950118.AECB@XIson.com>
  Content-Transfer-Encoding: BASE64
  Content-Description: Picture B

  [encoded jpeg image]
  --example-2--

5.3 Content-Disposition

in the example above, each image body part could also have a Content-Disposition header ๐ŸŒธ For example:

  --example-2
  Content-Type: image/jpeg
  Content-ID: <950118.AECB@XIson.com>
  Content-Transfer-Encoding: BASE64
  Content-Description: Picture B
  Content-Disposition: INLINE

  [encoded jpeg image]
  --example-2--

User Agents that recognize Multipart/Related will ignore the Content-Disposition header's disposition type ๐Ÿ™ˆ Other User Agents will process the Multipart/Related as Multipart/Mixed, and they may make use of that header's information ๐Ÿ’œ


that's part 1 of 2 bestie ๐ŸŒˆ more coming up in part 2 ๐Ÿ’–

6. User Agent Requirements ๐ŸŽ€

okay so, user agents that don't recognize Multipart/Related SHALL, in accordance with [MIME], treat the whole entity as Multipart/Mixed ๐Ÿซถ. MIME User Agents that do recognize Multipart/Related entities but can't process the given type SHOULD give the user the option of suppressing the entire Multipart/Related body part SHALL be ๐Ÿ’….

Existing MIME-capable mail user agents (MUAs) already handle the existing media types in a super straightforward way โœจ. For discrete media types (like text, image, etc.), the body of the entity can go straight to a display process. The existing composite subtypes can basically be broken down into one or more discrete types. Multipart/Related is different though ๐Ÿ˜ญ. You can't just reduce its processing to handling each entity on its own. It's a whole web of parts that depend on each other, and that's what makes it iconic ๐Ÿฆ‹.

The following sections talk about what information the processing application needs ๐Ÿ“‹.

It's possible that an application-specific "receiving agent" will tweak the entities for display before the actual application process runs ๐Ÿงš. Okie, from above, is a great example of this. It might need a receiving agent to parse the document and swap the originator's file names for local file names ๐ŸŒธ. Other applications might just need a table showing which local file names match the originator's ๐Ÿ“. The receiving agent takes responsibility for all of this processing ๐Ÿ‘‘.

6.1 Data Requirements

MIME-capable mail user agents (MUAs) are REQUIRED to provide the application with:

  • (a) the bodies of the MIME entities and the entity Content-* headers,
  • (b) the parameters of the Multipart/Related Content-type header, and
  • (c) the correspondence between each body's local file name, that body's header data, and, if present, the body part's content-ID.

The Multipart/Related media type will be used for objects that have internal linkages between their body parts ๐Ÿ”—. When the objects get stored, those linkages may need processing by the application or its receiving agent ๐Ÿ’œ.

6.3 Recursion

MIME is recursive, which is very main character energy ๐ŸŒˆ. So you have to expect a Multipart/Related entity to contain other Multipart/Related entities. When a Multipart/Related entity is being processed for display or storage, any enclosed Multipart/Related entities SHALL be processed as though they were being stored ๐Ÿงšโ€โ™€๏ธ.

6.4 Configuration Considerations

It's suggested that MUAs which use configuration mechanisms (see [CFG] for an example) refer to Multipart/Related as Multipart/Related/<type>, were <type> is the value of the "type" parameter ๐ŸŽ€.

7. Security Considerations ๐Ÿ”

Security considerations relevant to Multipart/Related are identical to those of the underlying content-type. So whatever risks come with the content-type you're wrapping, those are the ones you're dealing with, no cap ๐Ÿ’€.

8. Acknowledgments ๐Ÿซถ

This proposal came out of conversations the author had with lots of people ๐Ÿ’ฌ. In particular, Harald A. Alvestrand, James Clark, Charles Goldfarb, Gary Houston, Ned Freed, Ray Moody, and Don Stinchfield gave both encouragement and seriously invaluable help ๐Ÿ‘‘. The author, however, takes full responsibility for any errors in this document ๐Ÿ™ˆ.

9. References ๐Ÿ“š

  • [822] Crocker, D., "Standard for the Format of ARPA Internet Text Messages", STD 11, RFC 822, August 1982.
  • [CID] Levinson, E., and J. Clark, "Message/External-Body Content-ID Access Type", RFC 1873, December 1995, Levinson, E., "Message/External-Body Content-ID Access Type", Work in Progress.
  • [CFG] Borenstein, N., "A User Agent Configuration Mechanism For Multimedia Mail Format Information", RFC 1524, September 1993.
  • [DISP] Troost, R., and S. Dorner, "Communicating Presentation Information in Internet Messages: The Content-Disposition Header", RFC 1806, June 1995.
  • [MIME] Borenstein, N., and Freed, N., "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996.

9. Author's Address ๐Ÿ“ฎ

Edward Levinson 47 Clive Street Metuchen, NJ 08840-1060 USA

Phone: +1 908 494 1606 EMail: XIson@cnj.digex.com

10. Changes from previous draft (RFC 2112) ๐ŸŒธ

Corrected cid URLs to conform to RFC 2111. The angle brackets were removed โœจ.

Copyright (C) The Internet Society (1998). All Rights Reserved.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns ๐Ÿ’–.

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ๐Ÿฆ‹
๐Ÿ“ฆ where this page comes from