RFC 3516
IMAP4 Binary Content Extension
RFC 3516: IMAP4 Binary Content Extension β¨
okay bestie, this RFC is RFC 3516 π¦, titled "IMAP4 Binary Content Extension." It was written by Lyndon Nerenberg of Orthanc Systems in April 2003 π . It's on the Standards Track π. The header doesn't list anything it obsoletes or updates, so there's nothing to report there πΈ.
Status of this Memo
this is an Internet standards track protocol for the Internet community π«Ά and it's asking for discussion and suggestions for improvements π¬. for where it sits in the standardization process, check the current edition of the "Internet Official Protocol Standards" (STD 1) π. distribution of this memo is unlimited π.
Copyright Notice
Copyright (C) The Internet Society (2003). All Rights Reserved. πβ¨
Abstract
this memo defines the Binary extension to IMAP4 (the Internet Message Access Protocol) π¬. it gives clients and servers a way to swap message body data without using a MIME content-transfer-encoding ππ₯.
1. Conventions Used in this Document π
the key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" in this document are to be read as described in [KEYWORD] π. these are the capital-letter rules, so pay attention to them π.
"CTE" is short for content-transfer-encoding π.
2. Introduction π§
okay so MIME lets you send non-text (binary) message content [MIME-IMB] π. the thing is, the traditional messaging transports can't always pass binary data straight through π. MIME fixes that with encoding schemes that let binary content ride over transports that otherwise couldn't carry it π .
the catch? MIME encoding can be a LOT of overhead in some situations, like slow radio links or streaming multimedia π’. cutting down the overhead of CTE schemes such as base64 can noticeably save resources β¨. the Binary extension lets the server do the CTE decoding before it sends message data to the client π. iconic, honestly π.
3. Content-Transfer-Encoding Considerations π
every IMAP4 body section has a MIME content-transfer-encoding π§. if a section has no explicit Content-Transfer-Encoding header, it's implicitly labeled as "7bit" content πΈ. in the terminology of [MIME-IMB], the CTE specifies both a decoding algorithm and the domain of the decoded data π. in this memo, "decoding" means the CTE decoding step described in [MIME-IMB] π¦.
some CTEs use an identity encoding transformation. for those, there's no decoding needed π. BUT the domain of the underlying data might not be expressible in the IMAP4 protocol, like MIME "binary" content with NUL octets π. so to handle these cases, the Binary extension brings in a new kind of literal protocol element that is fully eight bit transparent π₯.
so server processing of the FETCH BINARY command has two logical steps π:
- perform any CTE-related decoding
- determine the domain of the decoded data
step 2 matters because it decides which protocol element gets used to transmit the decoded data π§. (see FETCH Response Extensions for the details β¨)
4. Framework for the IMAP4 Binary Extension ποΈ
this memo defines the following extensions to [IMAP4rev1] π .
4.1. CAPABILITY Identification πͺͺ
IMAP4 servers that support this extension MUST include "BINARY" in the response list to the CAPABILITY command π. no skipping this one, bestie π ββοΈ.
4.2. FETCH Command Extensions πΈ
this extension defines three new FETCH command data items π:
BINARY<section-binary>[<partial>]
requests that the specified section be sent after CTE-related decoding π«Ά.
the <partial> argument, if it's there, asks for just a subset of the data π§©. partial FETCH BINARY works the same as partial FETCH BODY, with one twist: the <partial> arguments refer to the DECODED section data π.
BINARY.PEEK<section-binary>[<partial>]
an alternate form of FETCH BINARY that does not implicitly set the \Seen flag ππ¦.
BINARY.SIZE<section-binary>
requests the decoded size of the section (basically, the size to expect back from the matching FETCH BINARY request) π.
Note: client authors are cautioned that this might be an expensive operation for some server implementations π. needlessly issuing this request could tank performance, because servers would have to calculate the value every single time it's requested π.
4.3. FETCH Response Extensions π¦
this extension defines two new FETCH response data items π:
BINARY<section-binary>[<<number>>]
this is an <nstring> or <literal8> holding the content of the specified section after any CTE-related encoding has been removed β¨. if <number> is present, it's the offset within the DECODED section data π§©.
if the domain of the decoded data is "8bit" and the data doesn't contain the NUL octet, the server SHOULD return the data in a <string> instead of a <literal8> π. the reason is slay: the client can tell whether the "8bit" data has a NUL octet without having to scan the whole data stream for NULs πβ¨.
if the server doesn't know how to decode the section's CTE, it MUST fail the request and issue a "NO" response that contains the "UNKNOWN-CTE" extended response code π.
BINARY.SIZE<section-binary>
the size of the section after any CTE-related encoding has been removed π. the value returned MUST match the size of the <nstring> or <literal8> that the corresponding FETCH BINARY request will return π«Ά.
if the server doesn't know how to decode the section's CTE, it MUST fail the request and issue a "NO" response that contains the "UNKNOWN-CTE" extended response code π.
4.4. APPEND Command Extensions π¨
the APPEND command gets extended so the client can append data containing NULs using the <literal8> syntax π. the server MAY modify the CTE of the appended data π¦, but any such transformation MUST NOT result in a loss of data π‘οΈ.
if the destination mailbox doesn't support storing binary content, the server MUST fail the request and issue a "NO" response that contains the "UNKNOWN-CTE" extended response code π.
5. MIME Encoded Headers π
[MIME-MHE] defines an encoding that allows non-US-ASCII text in message headers π. this encoding is not the same as the content-transfer-encoding used on message bodies π ββοΈ. so the decoding transformations in this memo do NOT apply to [MIME-MHE] encoded header text π.
a server MUST NOT perform any conversion of [MIME-MHE] encoded header text in response to any binary FETCH or APPEND request π.
6. Implementation Considerations π οΈ
okay real talk, messaging clients and servers have been notoriously lax about the Internet CRLF convention for ending lines of textual data π. when sending data with the Binary extension, servers MUST make sure textual line-oriented sections are always sent using the IMAP4 CRLF line termination syntax π, no matter how the data is stored on the server π .
a server may choose to store message body binary content in a non-encoded format π§. but whatever the internal storage looks like, the server MUST issue BODYSTRUCTURE responses that describe the message as if the binary-encoded sections were encoded in a CTE the IMAP4 base specification accepts π«Ά. and the results of a FETCH BODY MUST return the message body content in the format described by the matching FETCH BODYSTRUCTURE response π.
the server is allowed to modify the CTE of APPENDed <literal8> data, but it should only do that when it's absolutely necessary π. gratuitous encoding changes will wreck most cryptographic operations already performed on the message ππ.
this extension is an optimization for certain specific situations π¦. it does NOT let clients skip basic functionality (content transfer decoding) that every messaging client should have π . clients supporting this extension SHOULD be prepared to do their own CTE decoding operations πβ¨.
12. Full Copyright Statement β¨
Okay bestie, this is the legal bit, so I'm keeping the wording exactly as it is π Copyright is the one thing you can't remix, so here it is in full π
Copyright (C) The Internet Society (2003). 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.
Acknowledgement πΈ
Funding for the RFC Editor function is currently provided by the Internet Society. π«Ά
π¦ where this page comes from
- ietf: rfc3516 2003-04
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms