rfc2183.txt 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. Network Working Group R. Troost
  2. Request for Comments: 2183 New Century Systems
  3. Updates: 1806 S. Dorner
  4. Category: Standards Track QUALCOMM Incorporated
  5. K. Moore, Editor
  6. University of Tennessee
  7. August 1997
  8. Communicating Presentation Information in
  9. Internet Messages:
  10. The Content-Disposition Header Field
  11. Status of this Memo
  12. This document specifies an Internet standards track protocol for the
  13. Internet community, and requests discussion and suggestions for
  14. improvements. Please refer to the current edition of the "Internet
  15. Official Protocol Standards" (STD 1) for the standardization state
  16. and status of this protocol. Distribution of this memo is unlimited.
  17. Abstract
  18. This memo provides a mechanism whereby messages conforming to the
  19. MIME specifications [RFC 2045, RFC 2046, RFC 2047, RFC 2048, RFC
  20. 2049] can convey presentational information. It specifies the
  21. "Content-Disposition" header field, which is optional and valid for
  22. any MIME entity ("message" or "body part"). Two values for this
  23. header field are described in this memo; one for the ordinary linear
  24. presentation of the body part, and another to facilitate the use of
  25. mail to transfer files. It is expected that more values will be
  26. defined in the future, and procedures are defined for extending this
  27. set of values.
  28. This document is intended as an extension to MIME. As such, the
  29. reader is assumed to be familiar with the MIME specifications, and
  30. [RFC 822]. The information presented herein supplements but does not
  31. replace that found in those documents.
  32. This document is a revision to the Experimental protocol defined in
  33. RFC 1806. As compared to RFC 1806, this document contains minor
  34. editorial updates, adds new parameters needed to support the File
  35. Transfer Body Part, and references a separate specification for the
  36. handling of non-ASCII and/or very long parameter values.
  37. Troost, et. al. Standards Track [Page 1]
  38. RFC 2183 Content-Disposition August 1997
  39. 1. Introduction
  40. MIME specifies a standard format for encapsulating multiple pieces of
  41. data into a single Internet message. That document does not address
  42. the issue of presentation styles; it provides a framework for the
  43. interchange of message content, but leaves presentation issues solely
  44. in the hands of mail user agent (MUA) implementors.
  45. Two common ways of presenting multipart electronic messages are as a
  46. main document with a list of separate attachments, and as a single
  47. document with the various parts expanded (displayed) inline. The
  48. display of an attachment is generally construed to require positive
  49. action on the part of the recipient, while inline message components
  50. are displayed automatically when the message is viewed. A mechanism
  51. is needed to allow the sender to transmit this sort of presentational
  52. information to the recipient; the Content-Disposition header provides
  53. this mechanism, allowing each component of a message to be tagged
  54. with an indication of its desired presentation semantics.
  55. Tagging messages in this manner will often be sufficient for basic
  56. message formatting. However, in many cases a more powerful and
  57. flexible approach will be necessary. The definition of such
  58. approaches is beyond the scope of this memo; however, such approaches
  59. can benefit from additional Content-Disposition values and
  60. parameters, to be defined at a later date.
  61. In addition to allowing the sender to specify the presentational
  62. disposition of a message component, it is desirable to allow her to
  63. indicate a default archival disposition; a filename. The optional
  64. "filename" parameter provides for this. Further, the creation-date,
  65. modification-date, and read-date parameters allow preservation of
  66. those file attributes when the file is transmitted over MIME email.
  67. NB: The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD,
  68. SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when they appear in this
  69. document, are to be interpreted as described in [RFC 2119].
  70. 2. The Content-Disposition Header Field
  71. Content-Disposition is an optional header field. In its absence, the
  72. MUA may use whatever presentation method it deems suitable.
  73. It is desirable to keep the set of possible disposition types small
  74. and well defined, to avoid needless complexity. Even so, evolving
  75. usage will likely require the definition of additional disposition
  76. types or parameters, so the set of disposition values is extensible;
  77. see below.
  78. Troost, et. al. Standards Track [Page 2]
  79. RFC 2183 Content-Disposition August 1997
  80. In the extended BNF notation of [RFC 822], the Content-Disposition
  81. header field is defined as follows:
  82. disposition := "Content-Disposition" ":"
  83. disposition-type
  84. *(";" disposition-parm)
  85. disposition-type := "inline"
  86. / "attachment"
  87. / extension-token
  88. ; values are not case-sensitive
  89. disposition-parm := filename-parm
  90. / creation-date-parm
  91. / modification-date-parm
  92. / read-date-parm
  93. / size-parm
  94. / parameter
  95. filename-parm := "filename" "=" value
  96. creation-date-parm := "creation-date" "=" quoted-date-time
  97. modification-date-parm := "modification-date" "=" quoted-date-time
  98. read-date-parm := "read-date" "=" quoted-date-time
  99. size-parm := "size" "=" 1*DIGIT
  100. quoted-date-time := quoted-string
  101. ; contents MUST be an RFC 822 `date-time'
  102. ; numeric timezones (+HHMM or -HHMM) MUST be used
  103. NOTE ON PARAMETER VALUE LENGHTS: A short (length <= 78 characters)
  104. parameter value containing only non-`tspecials' characters SHOULD be
  105. represented as a single `token'. A short parameter value containing
  106. only ASCII characters, but including `tspecials' characters, SHOULD
  107. be represented as `quoted-string'. Parameter values longer than 78
  108. characters, or which contain non-ASCII characters, MUST be encoded as
  109. specified in [RFC 2184].
  110. `Extension-token', `parameter', `tspecials' and `value' are defined
  111. according to [RFC 2045] (which references [RFC 822] in the definition
  112. of some of these tokens). `quoted-string' and `DIGIT' are defined in
  113. [RFC 822].
  114. Troost, et. al. Standards Track [Page 3]
  115. RFC 2183 Content-Disposition August 1997
  116. 2.1 The Inline Disposition Type
  117. A bodypart should be marked `inline' if it is intended to be
  118. displayed automatically upon display of the message. Inline
  119. bodyparts should be presented in the order in which they occur,
  120. subject to the normal semantics of multipart messages.
  121. 2.2 The Attachment Disposition Type
  122. Bodyparts can be designated `attachment' to indicate that they are
  123. separate from the main body of the mail message, and that their
  124. display should not be automatic, but contingent upon some further
  125. action of the user. The MUA might instead present the user of a
  126. bitmap terminal with an iconic representation of the attachments, or,
  127. on character terminals, with a list of attachments from which the
  128. user could select for viewing or storage.
  129. 2.3 The Filename Parameter
  130. The sender may want to suggest a filename to be used if the entity is
  131. detached and stored in a separate file. If the receiving MUA writes
  132. the entity to a file, the suggested filename should be used as a
  133. basis for the actual filename, where possible.
  134. It is important that the receiving MUA not blindly use the suggested
  135. filename. The suggested filename SHOULD be checked (and possibly
  136. changed) to see that it conforms to local filesystem conventions,
  137. does not overwrite an existing file, and does not present a security
  138. problem (see Security Considerations below).
  139. The receiving MUA SHOULD NOT respect any directory path information
  140. that may seem to be present in the filename parameter. The filename
  141. should be treated as a terminal component only. Portable
  142. specification of directory paths might possibly be done in the future
  143. via a separate Content-Disposition parameter, but no provision is
  144. made for it in this draft.
  145. Current [RFC 2045] grammar restricts parameter values (and hence
  146. Content-Disposition filenames) to US-ASCII. We recognize the great
  147. desirability of allowing arbitrary character sets in filenames, but
  148. it is beyond the scope of this document to define the necessary
  149. mechanisms. We expect that the basic [RFC 1521] `value'
  150. specification will someday be amended to allow use of non-US-ASCII
  151. characters, at which time the same mechanism should be used in the
  152. Content-Disposition filename parameter.
  153. Troost, et. al. Standards Track [Page 4]
  154. RFC 2183 Content-Disposition August 1997
  155. Beyond the limitation to US-ASCII, the sending MUA may wish to bear
  156. in mind the limitations of common filesystems. Many have severe
  157. length and character set restrictions. Short alphanumeric filenames
  158. are least likely to require modification by the receiving system.
  159. The presence of the filename parameter does not force an
  160. implementation to write the entity to a separate file. It is
  161. perfectly acceptable for implementations to leave the entity as part
  162. of the normal mail stream unless the user requests otherwise. As a
  163. consequence, the parameter may be used on any MIME entity, even
  164. `inline' ones. These will not normally be written to files, but the
  165. parameter could be used to provide a filename if the receiving user
  166. should choose to write the part to a file.
  167. 2.4 The Creation-Date parameter
  168. The creation-date parameter MAY be used to indicate the date at which
  169. the file was created. If this parameter is included, the paramter
  170. value MUST be a quoted-string which contains a representation of the
  171. creation date of the file in [RFC 822] `date-time' format.
  172. UNIX and POSIX implementors are cautioned that the `st_ctime' file
  173. attribute of the `stat' structure is not the creation time of the
  174. file; it is thus not appropriate as a source for the creation-date
  175. parameter value.
  176. 2.5 The Modification-Date parameter
  177. The modification-date parameter MAY be used to indicate the date at
  178. which the file was last modified. If the modification-date parameter
  179. is included, the paramter value MUST be a quoted-string which
  180. contains a representation of the last modification date of the file
  181. in [RFC 822] `date-time' format.
  182. 2.6 The Read-Date parameter
  183. The read-date parameter MAY be used to indicate the date at which the
  184. file was last read. If the read-date parameter is included, the
  185. parameter value MUST be a quoted-string which contains a
  186. representation of the last-read date of the file in [RFC 822] `date-
  187. time' format.
  188. 2.7 The Size parameter
  189. The size parameter indicates an approximate size of the file in
  190. octets. It can be used, for example, to pre-allocate space before
  191. attempting to store the file, or to determine whether enough space
  192. exists.
  193. Troost, et. al. Standards Track [Page 5]
  194. RFC 2183 Content-Disposition August 1997
  195. 2.8 Future Extensions and Unrecognized Disposition Types
  196. In the likely event that new parameters or disposition types are
  197. needed, they should be registered with the Internet Assigned Numbers
  198. Authority (IANA), in the manner specified in Section 9 of this memo.
  199. Once new disposition types and parameters are defined, there is of
  200. course the likelihood that implementations will see disposition types
  201. and parameters they do not understand. Furthermore, since x-tokens
  202. are allowed, implementations may also see entirely unregistered
  203. disposition types and parameters.
  204. Unrecognized parameters should be ignored. Unrecognized disposition
  205. types should be treated as `attachment'. The choice of `attachment'
  206. for unrecognized types is made because a sender who goes to the
  207. trouble of producing a Content-Disposition header with a new
  208. disposition type is more likely aiming for something more elaborate
  209. than inline presentation.
  210. Unless noted otherwise in the definition of a parameter, Content-
  211. Disposition parameters are valid for all dispositions. (In contrast
  212. to MIME content-type parameters, which are defined on a per-content-
  213. type basis.) Thus, for example, the `filename' parameter still means
  214. the name of the file to which the part should be written, even if the
  215. disposition itself is unrecognized.
  216. 2.9 Content-Disposition and Multipart
  217. If a Content-Disposition header is used on a multipart body part, it
  218. applies to the multipart as a whole, not the individual subparts.
  219. The disposition types of the subparts do not need to be consulted
  220. until the multipart itself is presented. When the multipart is
  221. displayed, then the dispositions of the subparts should be respected.
  222. If the `inline' disposition is used, the multipart should be
  223. displayed as normal; however, an `attachment' subpart should require
  224. action from the user to display.
  225. If the `attachment' disposition is used, presentation of the
  226. multipart should not proceed without explicit user action. Once the
  227. user has chosen to display the multipart, the individual subpart
  228. dispositions should be consulted to determine how to present the
  229. subparts.
  230. Troost, et. al. Standards Track [Page 6]
  231. RFC 2183 Content-Disposition August 1997
  232. 2.10 Content-Disposition and the Main Message
  233. It is permissible to use Content-Disposition on the main body of an
  234. [RFC 822] message.
  235. 3. Examples
  236. Here is a an example of a body part containing a JPEG image that is
  237. intended to be viewed by the user immediately:
  238. Content-Type: image/jpeg
  239. Content-Disposition: inline
  240. Content-Description: just a small picture of me
  241. <jpeg data>
  242. The following body part contains a JPEG image that should be
  243. displayed to the user only if the user requests it. If the JPEG is
  244. written to a file, the file should be named "genome.jpg". The
  245. recipient's user might also choose to set the last-modified date of
  246. the stored file to date in the modification-date parameter:
  247. Content-Type: image/jpeg
  248. Content-Disposition: attachment; filename=genome.jpeg;
  249. modification-date="Wed, 12 Feb 1997 16:29:51 -0500";
  250. Content-Description: a complete map of the human genome
  251. <jpeg data>
  252. The following is an example of the use of the `attachment'
  253. disposition with a multipart body part. The user should see text-
  254. part-1 immediately, then take some action to view multipart-2. After
  255. taking action to view multipart-2, the user will see text-part-2
  256. right away, and be required to take action to view jpeg-1. Subparts
  257. are indented for clarity; they would not be so indented in a real
  258. message.
  259. Troost, et. al. Standards Track [Page 7]
  260. RFC 2183 Content-Disposition August 1997
  261. Content-Type: multipart/mixed; boundary=outer
  262. Content-Description: multipart-1
  263. --outer
  264. Content-Type: text/plain
  265. Content-Disposition: inline
  266. Content-Description: text-part-1
  267. Some text goes here
  268. --outer
  269. Content-Type: multipart/mixed; boundary=inner
  270. Content-Disposition: attachment
  271. Content-Description: multipart-2
  272. --inner
  273. Content-Type: text/plain
  274. Content-Disposition: inline
  275. Content-Description: text-part-2
  276. Some more text here.
  277. --inner
  278. Content-Type: image/jpeg
  279. Content-Disposition: attachment
  280. Content-Description: jpeg-1
  281. <jpeg data>
  282. --inner--
  283. --outer--
  284. 4. Summary
  285. Content-Disposition takes one of two values, `inline' and
  286. `attachment'. `Inline' indicates that the entity should be
  287. immediately displayed to the user, whereas `attachment' means that
  288. the user should take additional action to view the entity.
  289. The `filename' parameter can be used to suggest a filename for
  290. storing the bodypart, if the user wishes to store it in an external
  291. file.
  292. Troost, et. al. Standards Track [Page 8]
  293. RFC 2183 Content-Disposition August 1997
  294. 5. Security Considerations
  295. There are security issues involved any time users exchange data.
  296. While these are not to be minimized, neither does this memo change
  297. the status quo in that regard, except in one instance.
  298. Since this memo provides a way for the sender to suggest a filename,
  299. a receiving MUA must take care that the sender's suggested filename
  300. does not represent a hazard. Using UNIX as an example, some hazards
  301. would be:
  302. + Creating startup files (e.g., ".login").
  303. + Creating or overwriting system files (e.g., "/etc/passwd").
  304. + Overwriting any existing file.
  305. + Placing executable files into any command search path
  306. (e.g., "~/bin/more").
  307. + Sending the file to a pipe (e.g., "| sh").
  308. In general, the receiving MUA should not name or place the file such
  309. that it will get interpreted or executed without the user explicitly
  310. initiating the action.
  311. It is very important to note that this is not an exhaustive list; it
  312. is intended as a small set of examples only. Implementors must be
  313. alert to the potential hazards on their target systems.
  314. 6. References
  315. [RFC 2119]
  316. Bradner, S., "Key words for use in RFCs to Indicate Requirement
  317. Levels", RFC 2119, March 1997.
  318. [RFC 2184]
  319. Freed, N. and K. Moore, "MIME Parameter value and Encoded Words:
  320. Character Sets, Lanaguage, and Continuations", RFC 2184, August
  321. 1997.
  322. [RFC 2045]
  323. Freed, N. and N. Borenstein, "MIME (Multipurpose Internet Mail
  324. Extensions) Part One: Format of Internet Message Bodies", RFC
  325. 2045, December 1996.
  326. Troost, et. al. Standards Track [Page 9]
  327. RFC 2183 Content-Disposition August 1997
  328. [RFC 2046]
  329. Freed, N. and N. Borenstein, "MIME (Multipurpose Internet Mail
  330. Extensions) Part Two: Media Types", RFC 2046, December 1996.
  331. [RFC 2047]
  332. Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part
  333. Three: Message Header Extensions for non-ASCII Text", RFC 2047,
  334. December 1996.
  335. [RFC 2048]
  336. Freed, N., Klensin, J. and J. Postel, "MIME (Multipurpose
  337. Internet Mail Extensions) Part Four: Registration Procedures",
  338. RFC 2048, December 1996.
  339. [RFC 2049]
  340. Freed, N. and N. Borenstein, "MIME (Multipurpose Internet Mail
  341. Extensions) Part Five: Conformance Criteria and Examples", RFC
  342. 2049, December 1996.
  343. [RFC 822]
  344. Crocker, D., "Standard for the Format of ARPA Internet Text
  345. Messages", STD 11, RFC 822, UDEL, August 1982.
  346. 7. Acknowledgements
  347. We gratefully acknowledge the help these people provided during the
  348. preparation of this draft:
  349. Nathaniel Borenstein
  350. Ned Freed
  351. Keith Moore
  352. Dave Crocker
  353. Dan Pritchett
  354. Troost, et. al. Standards Track [Page 10]
  355. RFC 2183 Content-Disposition August 1997
  356. 8. Authors' Addresses
  357. You should blame the editor of this version of the document for any
  358. changes since RFC 1806:
  359. Keith Moore
  360. Department of Computer Science
  361. University of Tennessee, Knoxville
  362. 107 Ayres Hall
  363. Knoxville TN 37996-1301
  364. USA
  365. Phone: +1 (423) 974-5067
  366. Fax: +1 (423) 974-8296
  367. Email: moore@cs.utk.edu
  368. The authors of RFC 1806 are:
  369. Rens Troost
  370. New Century Systems
  371. 324 East 41st Street #804
  372. New York, NY, 10017 USA
  373. Phone: +1 (212) 557-2050
  374. Fax: +1 (212) 557-2049
  375. EMail: rens@century.com
  376. Steve Dorner
  377. QUALCOMM Incorporated
  378. 6455 Lusk Boulevard
  379. San Diego, CA 92121
  380. USA
  381. EMail: sdorner@qualcomm.com
  382. 9. Registration of New Content-Disposition Values and Parameters
  383. New Content-Disposition values (besides "inline" and "attachment")
  384. may be defined only by Internet standards-track documents, or in
  385. Experimental documents approved by the Internet Engineering Steering
  386. Group.
  387. Troost, et. al. Standards Track [Page 11]
  388. RFC 2183 Content-Disposition August 1997
  389. New content-disposition parameters may be registered by supplying the
  390. information in the following template and sending it via electronic
  391. mail to IANA@IANA.ORG:
  392. To: IANA@IANA.ORG
  393. Subject: Registration of new Content-Disposition parameter
  394. Content-Disposition parameter name:
  395. Allowable values for this parameter:
  396. (If the parameter can only assume a small number of values,
  397. list each of those values. Otherwise, describe the values
  398. that the parameter can assume.)
  399. Description:
  400. (What is the purpose of this parameter and how is it used?)
  401. 10. Changes since RFC 1806
  402. The following changes have been made since the earlier version of
  403. this document, published in RFC 1806 as an Experimental protocol:
  404. + Updated references to MIME documents. In some cases this
  405. involved substituting a reference to one of the current MIME
  406. RFCs for a reference to RFC 1521; in other cases, a reference to
  407. RFC 1521 was simply replaced with the word "MIME".
  408. + Added a section on registration procedures, since none of the
  409. procedures in RFC 2048 seemed to be appropriate.
  410. + Added new parameter types: creation-date, modification-date,
  411. read-date, and size.
  412. + Incorporated a reference to draft-freed-pvcsc-* for encoding
  413. long or non-ASCII parameter values.
  414. + Added reference to RFC 2119 to define MUST, SHOULD, etc.
  415. keywords.
  416. Troost, et. al. Standards Track [Page 12]