rfc3516.IMAP4_Binary_content_extension.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. Network Working Group L. Nerenberg
  2. Request for Comments: 3516 Orthanc Systems
  3. Category: Standards Track April 2003
  4. IMAP4 Binary Content Extension
  5. Status of this Memo
  6. This document specifies an Internet standards track protocol for the
  7. Internet community, and requests discussion and suggestions for
  8. improvements. Please refer to the current edition of the "Internet
  9. Official Protocol Standards" (STD 1) for the standardization state
  10. and status of this protocol. Distribution of this memo is unlimited.
  11. Copyright Notice
  12. Copyright (C) The Internet Society (2003). All Rights Reserved.
  13. Abstract
  14. This memo defines the Binary extension to the Internet Message Access
  15. Protocol (IMAP4). It provides a mechanism for IMAP4 clients and
  16. servers to exchange message body data without using a MIME content-
  17. transfer-encoding.
  18. 1. Conventions Used in this Document
  19. The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
  20. in this document are to be interpreted as described in [KEYWORD].
  21. The abbreviation "CTE" means content-transfer-encoding.
  22. 2. Introduction
  23. The MIME extensions to Internet messaging allow for the transmission
  24. of non-textual (binary) message content [MIME-IMB]. Since the
  25. traditional transports for messaging are not always capable of
  26. passing binary data transparently, MIME provides encoding schemes
  27. that allow binary content to be transmitted over transports that are
  28. not otherwise able to do so.
  29. The overhead of MIME-encoding this content can be considerable in
  30. some contexts (e.g., slow radio links, streaming multimedia).
  31. Reducing the overhead associated with CTE schemes such as base64
  32. Nerenberg Standards Track [Page 1]
  33. RFC 3516 IMAP4 Binary Content Extension April 2003
  34. can give a noticeable reduction in resource consumption. The Binary
  35. extension lets the server perform CTE decoding prior to transmitting
  36. message data to the client.
  37. 3. Content-Transfer-Encoding Considerations
  38. Every IMAP4 body section has a MIME content-transfer-encoding.
  39. (Those without an explicit Content-Transfer-Encoding header are
  40. implicitly labeled as "7bit" content.) In the terminology of [MIME-
  41. IMB], the CTE specifies both a decoding algorithm and the domain of
  42. the decoded data. In this memo, "decoding" refers to the CTE
  43. decoding step described in [MIME-IMB].
  44. Certain CTEs use an identity encoding transformation. For these CTEs
  45. there is no decoding required, however the domain of the underlying
  46. data may not be expressible in the IMAP4 protocol (e.g., MIME
  47. "binary" content containing NUL octets). To accommodate these cases
  48. the Binary extension introduces a new type of literal protocol
  49. element that is fully eight bit transparent.
  50. Thus, server processing of the FETCH BINARY command involves two
  51. logical steps:
  52. 1) perform any CTE-related decoding
  53. 2) determine the domain of the decoded data
  54. Step 2 is necessary to determine which protocol element should be
  55. used to transmit the decoded data. (See FETCH Response Extensions
  56. for further details.)
  57. 4. Framework for the IMAP4 Binary Extension
  58. This memo defines the following extensions to [IMAP4rev1].
  59. 4.1. CAPABILITY Identification
  60. IMAP4 servers that support this extension MUST include "BINARY" in
  61. the response list to the CAPABILITY command.
  62. 4.2. FETCH Command Extensions
  63. This extension defines three new FETCH command data items.
  64. BINARY<section-binary>[<partial>]
  65. Requests that the specified section be transmitted after
  66. performing CTE-related decoding.
  67. Nerenberg Standards Track [Page 2]
  68. RFC 3516 IMAP4 Binary Content Extension April 2003
  69. The <partial> argument, if present, requests that a subset of
  70. the data be returned. The semantics of a partial FETCH BINARY
  71. command are the same as for a partial FETCH BODY command, with
  72. the exception that the <partial> arguments refer to the DECODED
  73. section data.
  74. BINARY.PEEK<section-binary>[<partial>]
  75. An alternate form of FETCH BINARY that does not implicitly set
  76. the \Seen flag.
  77. BINARY.SIZE<section-binary>
  78. Requests the decoded size of the section (i.e., the size to
  79. expect in response to the corresponding FETCH BINARY request).
  80. Note: client authors are cautioned that this might be an
  81. expensive operation for some server implementations.
  82. Needlessly issuing this request could result in degraded
  83. performance due to servers having to calculate the value every
  84. time the request is issued.
  85. 4.3. FETCH Response Extensions
  86. This extension defines two new FETCH response data items.
  87. BINARY<section-binary>[<<number>>]
  88. An <nstring> or <literal8> expressing the content of the
  89. specified section after removing any CTE-related encoding. If
  90. <number> is present it refers to the offset within the DECODED
  91. section data.
  92. If the domain of the decoded data is "8bit" and the data does
  93. not contain the NUL octet, the server SHOULD return the data in
  94. a <string> instead of a <literal8>; this allows the client to
  95. determine if the "8bit" data contains the NUL octet without
  96. having to explicitly scan the data stream for for NULs.
  97. If the server does not know how to decode the section's CTE, it
  98. MUST fail the request and issue a "NO" response that contains
  99. the "UNKNOWN-CTE" extended response code.
  100. Nerenberg Standards Track [Page 3]
  101. RFC 3516 IMAP4 Binary Content Extension April 2003
  102. BINARY.SIZE<section-binary>
  103. The size of the section after removing any CTE-related
  104. encoding. The value returned MUST match the size of the
  105. <nstring> or <literal8> that will be returned by the
  106. corresponding FETCH BINARY request.
  107. If the server does not know how to decode the section's CTE, it
  108. MUST fail the request and issue a "NO" response that contains
  109. the "UNKNOWN-CTE" extended response code.
  110. 4.4. APPEND Command Extensions
  111. The APPEND command is extended to allow the client to append data
  112. containing NULs by using the <literal8> syntax. The server MAY
  113. modify the CTE of the appended data, however any such transformation
  114. MUST NOT result in a loss of data.
  115. If the destination mailbox does not support the storage of binary
  116. content, the server MUST fail the request and issue a "NO" response
  117. that contains the "UNKNOWN-CTE" extended response code.
  118. 5. MIME Encoded Headers
  119. [MIME-MHE] defines an encoding that allows for non-US-ASCII text in
  120. message headers. This encoding is not the same as the content-
  121. transfer-encoding applied to message bodies, and the decoding
  122. transformations described in this memo do not apply to [MIME-MHE]
  123. encoded header text. A server MUST NOT perform any conversion of
  124. [MIME-MHE] encoded header text in response to any binary FETCH or
  125. APPEND request.
  126. 6. Implementation Considerations
  127. Messaging clients and servers have been notoriously lax in their
  128. adherence to the Internet CRLF convention for terminating lines of
  129. textual data in Internet protocols. When sending data using the
  130. Binary extension, servers MUST ensure that textual line-oriented
  131. sections are always transmitted using the IMAP4 CRLF line termination
  132. syntax, regardless of the underlying storage representation of the
  133. data on the server.
  134. A server may choose to store message body binary content in a non-
  135. encoded format. Regardless of the internal storage representation
  136. used, the server MUST issue BODYSTRUCTURE responses that describe the
  137. message as though the binary-encoded sections are encoded in a CTE
  138. Nerenberg Standards Track [Page 4]
  139. RFC 3516 IMAP4 Binary Content Extension April 2003
  140. acceptable to the IMAP4 base specification. Furthermore, the results
  141. of a FETCH BODY MUST return the message body content in the format
  142. described by the corresponding FETCH BODYSTRUCTURE response.
  143. While the server is allowed to modify the CTE of APPENDed <literal8>
  144. data, this should only be done when it is absolutely necessary.
  145. Gratuitous encoding changes will render useless most cryptographic
  146. operations that have been performed on the message.
  147. This extension provides an optimization that is useful in certain
  148. specific situations. It does not absolve clients from providing
  149. basic functionality (content transfer decoding) that should be
  150. available in all messaging clients. Clients supporting this
  151. extension SHOULD be prepared to perform their own CTE decoding
  152. operations.
  153. 7. Formal Protocol Syntax
  154. The following syntax specification uses the augmented Backus-Naur
  155. Form (ABNF) notation as used in [ABNF], and incorporates by reference
  156. the Core Rules defined in that document.
  157. This syntax augments the grammar specified in [IMAP4rev1].
  158. append =/ "APPEND" SP mailbox [SP flag-list]
  159. [SP date-time] SP literal8
  160. fetch-att =/ "BINARY" [".PEEK"] section-binary [partial]
  161. / "BINARY.SIZE" section-binary
  162. literal8 = "~{" number "}" CRLF *OCTET
  163. ; <number> represents the number of OCTETs
  164. ; in the response string.
  165. msg-att-static =/ "BINARY" section-binary SP (nstring / literal8)
  166. / "BINARY.SIZE" section-binary SP number
  167. partial = "<" number "." nz-number ">"
  168. resp-text-code =/ "UNKNOWN-CTE"
  169. section-binary = "[" [section-part] "]"
  170. Nerenberg Standards Track [Page 5]
  171. RFC 3516 IMAP4 Binary Content Extension April 2003
  172. 8. Normative References
  173. [ABNF] Crocker, D., Editor, and P. Overell, "Augmented BNF for
  174. Syntax Specifications: ABNF", RFC 2234, November 1997.
  175. [IMAP4rev1] Crispin, M., "Internet Message Access Protocol Version
  176. 4rev1", RFC 3501, March 2003.
  177. [KEYWORD] Bradner, S., "Key words for use in RFCs to Indicate
  178. Requirement Levels", BCP 14, RFC 2119, March 1997.
  179. [MIME-IMB] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
  180. Extensions (MIME) Part One: Format of Internet Message
  181. Bodies", RFC 2045, November 1996.
  182. [MIME-MHE] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
  183. Part Three: Message Header Extensions for Non-ASCII
  184. Text", RFC 2047, November 1996.
  185. 9. Security Considerations
  186. There are no known additional security issues with this extension
  187. beyond those described in the base protocol described in [IMAP4rev1].
  188. 10. Intellectual Property
  189. The IETF takes no position regarding the validity or scope of any
  190. intellectual property or other rights that might be claimed to
  191. pertain to the implementation or use of the technology described in
  192. this document or the extent to which any license under such rights
  193. might or might not be available; neither does it represent that it
  194. has made any effort to identify any such rights. Information on the
  195. IETF's procedures with respect to rights in standards-track and
  196. standards-related documentation can be found in BCP-11. Copies of
  197. claims of rights made available for publication and any assurances of
  198. licenses to be made available, or the result of an attempt made to
  199. obtain a general license or permission for the use of such
  200. proprietary rights by implementors or users of this specification can
  201. be obtained from the IETF Secretariat.
  202. The IETF invites any interested party to bring to its attention any
  203. copyrights, patents or patent applications, or other proprietary
  204. rights which may cover technology that may be required to practice
  205. this standard. Please address the information to the IETF Executive
  206. Director.
  207. Nerenberg Standards Track [Page 6]
  208. RFC 3516 IMAP4 Binary Content Extension April 2003
  209. 11. Author's Address
  210. Lyndon Nerenberg
  211. Orthanc Systems
  212. 1606 - 10770 Winterburn Road
  213. Edmonton, Alberta
  214. Canada T5S 1T6
  215. EMail: lyndon@orthanc.ab.ca
  216. Nerenberg Standards Track [Page 7]
  217. RFC 3516 IMAP4 Binary Content Extension April 2003
  218. 12. Full Copyright Statement
  219. Copyright (C) The Internet Society (2003). All Rights Reserved.
  220. This document and translations of it may be copied and furnished to
  221. others, and derivative works that comment on or otherwise explain it
  222. or assist in its implementation may be prepared, copied, published
  223. and distributed, in whole or in part, without restriction of any
  224. kind, provided that the above copyright notice and this paragraph are
  225. included on all such copies and derivative works. However, this
  226. document itself may not be modified in any way, such as by removing
  227. the copyright notice or references to the Internet Society or other
  228. Internet organizations, except as needed for the purpose of
  229. developing Internet standards in which case the procedures for
  230. copyrights defined in the Internet Standards process must be
  231. followed, or as required to translate it into languages other than
  232. English.
  233. The limited permissions granted above are perpetual and will not be
  234. revoked by the Internet Society or its successors or assigns.
  235. This document and the information contained herein is provided on an
  236. "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  237. TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  238. BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  239. HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  240. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  241. Acknowledgement
  242. Funding for the RFC Editor function is currently provided by the
  243. Internet Society.
  244. Nerenberg Standards Track [Page 8]