RFC 1806
Communicating Presentation Information in Internet Messages: The Content-Disposition Header
Part 1 of 2 ๐ธ
RFC 1806: Communicating Presentation Information in Internet Messages: The Content-Disposition Header โจ
Okay bestie, let's start with the vibes ๐ This is RFC 1806, a Request for Comments from the Network Working Group ๐ป, and it's titled Communicating Presentation Information in Internet Messages: The Content-Disposition Header. R. Troost from New Century Systems and S. Dorner from QUALCOMM Incorporated wrote it together ๐. It's categorised as Experimental ๐งช and it's dated June 1995 ๐๏ธ.
Status of This Memo โจ
So this memo is an Experimental Protocol ๐งช for the whole Internet community. It is not an Internet standard of any kind ๐ The authors actually want your thoughts and suggestions for making it better ๐ And distribution is unlimited, so share away ๐ฆ
Abstract ๐
Okay so this memo gives messages that follow the [RFC 1521] ("MIME") spec a way to say how they'd like to be presented ๐ The big new thing is a "Content-Disposition" header ๐ It's optional, and it works on any [RFC 1521] entity, whether that's a "message" or a "body part" โจ There are two values described here: one for ordinary linear presentation of the body part ๐, and one for using mail to transfer files ๐ More values are expected down the road, and there are procedures for adding them ๐ฎ
This doc is an extension of [RFC 1521] ๐งฉ so you're assumed to already know [RFC 1521] and [RFC 822] ๐ Everything here adds to those docs, it doesn't replace them ๐
1. Introduction ๐ธ
[RFC 1521] gives us a standard format for stuffing multiple pieces of data into one Internet message ๐ฆ But it doesn't talk about presentation styles at all! It's more of a framework for swapping message content around, and it leaves all the presentation decisions up to the mail user agent (MUA) implementors ๐ซ
There are two common ways to show a multipart message: as a main document with a list of separate attachments, or as one document with all the parts expanded and displayed inline ๐งต Showing an attachment usually takes a deliberate action from the reader ๐, while inline pieces just show up when the message is viewed โจ So the sender needs a way to say what they want, and that's where Content-Disposition comes in ๐ท๏ธ It lets every component of a message get tagged with its desired presentation semantics ๐
Tagging things like this will often be enough for basic formatting ๐โโ๏ธ For fancier stuff, though, you'll want something more powerful and flexible ๐ Designing that is out of scope for this memo, but those approaches can totally benefit from extra Content-Disposition values and parameters, to be defined at a later date ๐ฎ
Also, she might want to pass along a default archival name for the part, which is a filename ๐ That's what the optional "filename" parameter is for ๐๏ธ
2. The Content-Disposition Header Field ๐
Content-Disposition is an optional header ๐ If it's not there, the MUA MAY use whatever presentation method it deems suitable ๐คทโโ๏ธ
We want the set of possible disposition types to stay small and well defined so things don't get messy ๐งน Still, real-world usage will probably call for new disposition types or parameters, so the set of disposition values is extensible. More on that below ๐ฆ
Here's the extended BNF notation from [RFC 822] that defines the Content-Disposition header field ๐ง
disposition := "Content-Disposition" ":"
disposition-type
*(";" disposition-parm)
disposition-type := "inline"
/ "attachment"
/ extension-token
; values are not case-sensitive
disposition-parm := filename-parm / parameter
filename-parm := "filename" "=" value;
Extension-token, parameter and value are all defined by [RFC 822] and [RFC 1521] ๐
2.1. The Inline Disposition Type ๐
A bodypart SHOULD be marked inline if it's meant to be displayed automatically when the message is displayed ๐ Inline bodyparts SHOULD be presented in the order they occur, following the normal semantics of multipart messages ๐
2.2. The Attachment Disposition Type ๐
Bodyparts can be designated attachment to show they're separate from the main body of the mail ๐ Their display SHOULD NOT be automatic, and it depends on some further action from the user ๐ The MUA might instead show a bitmap-terminal user an iconic representation of the attachments ๐ผ๏ธ Or, on character terminals, it might hand over a list of attachments to pick from for viewing or storage ๐พ
2.3. The Filename Parameter ๐
The sender may want to suggest a filename to be used if the entity is detached and stored in a separate file ๐ If the receiving MUA writes the entity to a file, the suggested filename SHOULD be used as a basis for the actual filename, where possible โจ
It is super important that the receiving MUA doesn't just blindly use the suggested filename ๐จ The suggested filename SHOULD be checked (and maybe changed) to make sure it conforms to local filesystem conventions, doesn't overwrite an existing file, and isn't a security problem (see Security Considerations below) ๐
The receiving MUA SHOULD NOT respect any directory path information that seems to be present in the filename parameter ๐ The filename SHOULD be treated as a terminal component only ๐ Portable specification of directory paths might possibly be done in the future through a separate Content-Disposition parameter, but this draft doesn't make any provision for it ๐ฎ
Current [RFC 1521] grammar restricts parameter values (and so Content-Disposition filenames) to US-ASCII ๐ค We totally recognize how desirable it is to allow arbitrary character sets in filenames ๐ but defining the necessary mechanisms is beyond the scope of this document. We expect the basic [RFC 1521] value specification will someday be amended to allow non-US-ASCII characters ๐ At that point, the same mechanism SHOULD be used in the Content-Disposition filename parameter โจ
Beyond the US-ASCII limit, the sending MUA MAY wish to bear in mind the limitations of common filesystems ๐พ Many have severe length and character set restrictions. Short alphanumeric filenames are the least likely to need modification by the receiving system ๐คโจ
The presence of the filename parameter does not force an implementation to write the entity to a separate file ๐ It's perfectly acceptable for implementations to leave the entity as part of the normal mail stream unless the user asks otherwise ๐ฌ So the parameter MAY be used on any MIME entity, even inline ones ๐ฏ These won't normally be written to files, but the parameter can still provide a filename if the receiving user should choose to write the part to a file ๐พ
2.4. Future Extensions and Unrecognized Disposition Types ๐ฆ
In the likely event that new parameters or disposition types are needed, they SHOULD be registered with the IANA, in the manner specified in [RFC 1521], appendix E ๐
Once new disposition types and parameters are defined, implementations will probably run into disposition types and parameters they don't understand ๐คท And since x-tokens are allowed, they might also run into entirely unregistered disposition types and parameters ๐
Unrecognized parameters SHOULD be ignored ๐ Unrecognized disposition types SHOULD be treated as attachment ๐ The reason is that a sender who goes to the trouble of producing a Content-Disposition header with a new disposition type is more likely aiming for something fancier than inline presentation ๐
Unless noted otherwise in the definition of a parameter, Content-Disposition parameters are valid for all dispositions ๐ (This is different from [RFC 1521] content-type parameters, which are defined on a per-content-type basis.) So, for example, the filename parameter still means the name of the file to which the part should be written, even if the disposition itself is unrecognized ๐
2.5. Content-Disposition and Multipart ๐งฉ
If a Content-Disposition header is used on a multipart body part, it applies to the multipart as a whole, not the individual subparts ๐งฉ The disposition types of the subparts don't need to be consulted until the multipart itself is presented ๐ When the multipart is displayed, the dispositions of the subparts SHOULD be respected ๐
If the inline disposition is used, the multipart SHOULD be displayed as normal; however, an attachment subpart SHOULD require action from the user to display ๐
If the attachment disposition is used, presentation of the multipart SHOULD NOT proceed without explicit user action ๐ Once the user has chosen to display the multipart, the individual subpart dispositions SHOULD be consulted to figure out how to present the subparts ๐
2.6. Content-Disposition and the Main Message ๐
It is permissible to use Content-Disposition on the main body of an [RFC 822] message โ
โฆto be continued in Part 2 ๐
4. Summary โจ
okay so bestie, Content-Disposition only has two values: inline and attachment ๐. inline basically means "show this to the user right away" ๐, and attachment means the user has to do something extra before they can see it ๐.
The filename parameter is the sender's little suggestion for what to call the bodypart if the user wants to save it to an external file ๐๐ฆ.
5. Security Considerations ๐
okay this part is SO important, so pay attention ๐ . Any time users swap data there are security issues. This memo doesn't make them smaller, and it doesn't change the status quo either, except in one instance ๐ญ.
Since this memo lets the sender suggest a filename, a receiving MUA must take care that the suggested filename doesn't turn into a hazard. Using UNIX as the example, some hazards are:
- Creating startup files (e.g.,
".login"). - Creating or overwriting system files (e.g.,
"/etc/passwd"). - Overwriting any existing file.
- Placing executable files into any command search path (e.g.,
"~/bin/more"). - Sending the file to a pipe (e.g.,
"| sh").
In general, the receiving MUA should never name or place the file in a way that gets it interpreted or executed without the user explicitly starting that action ๐.
It is very important to note that this is NOT an exhaustive list! It's just a small set of examples. Implementors must be alert to the potential hazards on their target systems ๐
6. References ๐
[RFC 1521] Borenstein N., and N. Freed, "MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies", RFC 1521, Bellcore, Innosoft, September 1993.
[RFC 822] Crocker, D., "Standard for the Format of ARPA Internet Text Messages", STD 11, RFC 822, UDEL, August 1982.
7. Acknowledgements ๐ซถ
we gratefully acknowledge the help these people gave during the preparation of this draft ๐:
- Nathaniel Borenstein
- Ned Freed
- Keith Moore
- Dave Crocker
- Dan Pritchett
8. Authors' Addresses ๐ธ
and here are the people who wrote it, with their contact details ๐ง:
Rens Troost
New Century Systems
324 East 41st Street #804
New York, NY, 10017 USA
Phone: +1 (212) 557-2050
Fax: +1 (212) 557-2049
EMail: rens@century.com
Steve Dorner
QUALCOMM Incorporated
6455 Lusk Boulevard
San Diego, CA 92121
USA
EMail: sdorner@qualcomm.com
that's the whole thing, bestie! ๐โจ
๐ฆ where this page comes from
- ietf: rfc1806 1995-06
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms