RFC 2112

The MIME Multipart/Related Content-type

πŸ“… published March 1997, from ietf

Okay bestie, look at this title block first πŸŽ€ This doc is from the Network Working Group and it's Request for Comments: 2112. It was written by E. Levinson from XIson, Inc. ✨ It's a Standards Track doc, dated March 1997, and it obsoletes RFC 1872 πŸ¦‹ It doesn't update anything else.

Status of this Memo ✨

This doc is an Internet standards track protocol for the Internet community, and it's basically asking for discussion and suggestions for improvements 🫢 For the current standardization state and status, check the "Internet Official Protocol Standards" (STD 1) πŸ’… Distribution of this memo is unlimited, so share away 🌈

Abstract πŸŽ€

The Multipart/Related content-type is the main character for representing objects that are made of related MIME body parts πŸ’œ This doc defines Multipart/Related and gives examples of how to use it ✨

1. Introduction πŸ¦‹

Okay so a bunch of MIME stuff, like MIME-PEM, MIME-Macintosh, and other proposals, all need multiple body parts that only make sense when you look at them together 🧚 The old way of handling this was to make a new multipart subtype for every new object 😭 But MIME is all about having one mechanism for lots of different purposes, so this doc gives us a single mechanism for these aggregate or compound objects πŸ’…

Multipart/Related is how we represent compound objects in MIME πŸ”₯ The object gets labeled with a "type" parameter. There are extra parameters for pointing to a specific starting body part (the root) and for auxiliary info that might be needed when unpacking or processing the object 🌸

Multipart/Related MIME entities can have Content-Disposition headers that suggest how a body part should be stored and displayed πŸŽ€ But Multipart/Related processing wins over Content-Disposition, and section 4 explains how they work together ✨

Whoever builds the compound object is also the one responsible for displaying or processing its parts πŸ‘‘

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 🧚

Multipart/Related is for compound objects that have several inter-related body parts πŸ¦‹ You literally can't display a Multipart/Related object by showing each body part on its own, it's giving "the whole is more than the parts" 😭 The content-type of the whole object is set by the type parameter. The "start" parameter (if you include it) uses a content-ID to point at the body part with the object root πŸ’– If you don't include it, 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 are often links inside the components that point at the other components 🫢 Inside one operating environment those links are often file names, and in a MIME message they can be represented with content-IDs or the value of some other "Content-" headers ✨

3.1. The Type Parameter πŸŽ€

The type parameter is required, 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 inside the enclosed body part ✨ If the type parameter's value and the root body part's content-type are different, the User Agent's behavior is undefined πŸ™ˆ

3.2. The Start Parameter πŸ¦‹

The start parameter (if 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 πŸ‘‘

3.3. The Start-Info Parameter 🌈

The start-info parameter gives extra info to an application 🧚 It holds either a string, or a content-ID that points to another MIME entity in the message πŸ’œ A typical use would be extra command line parameters or a MIME entity with auxiliary info for processing the compound object πŸ”₯

Applications that use Multipart/Related must spell out how they interpret start-info ✨ User Agents shall pass the parameter's value along 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 πŸ’–

  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 "<"

Parameter values usually need quoting, bestie πŸ™ˆ Msg-id has special characters like "<", ">", and "@", plus maybe others 🫢 If msg-id has quoted-strings in it, those quote marks must be escaped πŸ’… The type parameter has a special character too, the "/" πŸ¦‹

4. Handling Content-Disposition Headers πŸ”₯

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 how things should be presented 🌸 [DISP] also allows an optional storage (file) name 🧚 Content-Disposition headers can 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 might find the Content-Disposition info useful 🌈

With Multipart/Related, though, the application that processes the compound object decides the presentation style for all of the contained parts πŸ‘‘ In that case the Content-Disposition header info is redundant, or even misleading 😭 So User Agents that understand Multipart/Related shall ignore the disposition type within a Multipart/Related body part πŸ™ˆ

A User Agent that handles both Multipart/Related and Content-Disposition headers could pass the invoked application the Content-Disposition header's optional filename parameter, as the Multipart/Related's filename πŸ¦‹ How that info gets used depends on the specific application, and it should be specified when describing how the matching compound object is handled ✨ Those descriptions would fit 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 written 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" πŸ”₯

The example below 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 πŸ’–

Text/X-Okie is a made-up markup language that lets you include images with text πŸ¦‹ The cool thing about this example is that it has two extra body parts, both pictures 🌈 The encapsulated document refers to them internally using each picture's body part content-ID πŸ’… Using "cid:" like this might be handy for lots of compound objects 🧚 But it's not part of the Multipart/Related spec, so don't get it twisted πŸ™ˆ

  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 ✨ Here's what that looks like πŸ‘‘

  ...
  --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 info 🫢

6. User Agent Requirements ✨

okay so bestie, this part is all about what user agents have to do, and the first thing is what happens when a client doesn't know Multipart/Related at all πŸ‘€. Those clients shall, following [MIME], treat the whole entity as Multipart/Mixed. 🫢 Then there's the in-between case: MIME User Agents that do recognize Multipart/Related but can't process the particular type should give the user the option of suppressing the entire Multipart/Related body part shall be. πŸ’… The user gets the final say!!

Existing MIME-capable mail user agents (MUAs) already handle the existing media types in a super straightforward way ✨. For discrete media types (e.g. text, image, etc.), the body of the entity can go straight to a display process. The composite subtypes can basically be broken down into handling one or more discrete types. Multipart/Related is different though, because you can't just handle each entity on its own 😭. The processing is all about how the parts relate to each other, so it's a whole vibe.

Next up are the details the processing application needs to know 🌸.

It's possible that an application-specific "receiving agent" will tweak the entities for display before the actual application process gets them πŸ¦‹. Okie, above, is an example of this: it may need a receiving agent to parse the document and swap in local file names for the originator's file names. Other applications might only need a table showing how local file names match up with the originator's. The receiving agent takes responsibility for all of that processing πŸ’œ.

6.1 Data Requirements

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

  • (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.

Basically the app needs all the receipts πŸ§ΎπŸŽ€.

Multipart/Related is the media type for objects with internal linkages between body parts πŸ”—. When these objects get stored, those linkages may need processing by the application or its receiving agent. Keep that in mind, bestie 🌈.

6.3 Recursion

MIME is recursive, so you've got 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. Nesting is no cap a whole mood 😭πŸ”₯.

6.4 Configuration Considerations

It's suggested that MUAs using configuration mechanisms (see [CFG] for an example) refer to Multipart/Related as Multipart/Related/<type>, where <type> is the value of the "type" parameter 🧚. Cute and organized, periodt ✨.


7. Security considerations πŸ”

Security considerations relevant to Multipart/Related are identical to those of the underlying content-type. So no sneaky new threats here, but you still have to take the underlying content-type's security seriously, bestie πŸ’€. Don't skip it!!

8. Acknowledgments 🫢

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

9. References πŸ“š

  • [822] Crocker, D., "Standard for the Format of ARPA Internet Text Messages", August 1982, University of Delaware, RFC 822.
  • [CID] E. Levinson, J. Clark, "Message/External-Body Content-ID Access Type", 12/26/1995, RFC 1873 Levinson, E., "Message/External-Body Content-ID Access Type", February 1997, RFC 2111.
  • [CFG] Borenstein, N., "A User Agent Configuration Mechanism For Multimedia Mail Format Information", September 23, 1993, RFC 1524.
  • [DISP] R. Troost, S. Dorner, "Communicating Presentation Information in Internet Messages: The Content-Disposition Header", June 7, 1995, RFC 1806.
  • [MIME] Borenstein, N. and Freed, N., "MIME (Multipurpose Internet Mail Extensions): Mechanisms for Specifying and Describing the Format of Internet Message Bodies", June 1992, RFC 1341.

9. Author's Address 🌷

Edward Levinson
XIson, Inc.
47 Clive Street
Metuchen, NJ  08840-1060
USA
+1 908 549 3716
<XIson@cnj.digex.com>

That's the whole RFC, bestie! πŸŒˆπŸ’– Edward really brought the receipts, and you now know exactly how Multipart/Related works. Iconic, honestly πŸ‘‘βœ¨

πŸ“¦ where this page comes from