RFC 8438

IMAP Extension for STATUS=SIZE

๐Ÿ“… published August 2018, from ietf

Internet Engineering Task Force (IETF) ๐ŸŽ€ RFC 8438: IMAP Extension for STATUS=SIZE โœจ

Okay bestie, so this is an IETF Standards Track doc ๐Ÿ’… from August 2018, written by Stephan Bosch of Dovecot Oy ๐Ÿฆ‹. It's an official IETF Proposed Standard-level product, approved by the IESG, and it doesn't obsolete or update any other RFCs ๐ŸŒธ. Sweet and simple!

Abstract โœจ

Okay so this doc adds a new capability called "STATUS=SIZE" to IMAP ๐Ÿ’–. The whole point is that you can get a mailbox's total storage size with ONE STATUS command, instead of fetching and adding up the size of every single message in it ๐Ÿงš. Main character efficiency. ๐Ÿ’…


Status of This Memo ๐ŸŒˆ

This is an Internet Standards Track doc ๐Ÿ’œ. It's a product of the IETF, it reflects the consensus of the IETF community, got public review, and was approved by the IESG ๐Ÿ‘‘. If you want more on Internet Standards, check Section 2 of RFC 7841 ๐Ÿฆ‹.

Info about the current status, errata, and feedback is at https://www.rfc-editor.org/info/rfc8438 ๐ŸŒธ.

Copyright (c) 2018 IETF Trust and the document authors. All rights reserved ๐Ÿ’…. This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as they were on the publication date, so read those carefully bestie, they explain your rights ๐Ÿ“œ. Any code pulled out of this doc has to include Simplified BSD License text (Section 4.e of the Trust Legal Provisions) and comes with no warranty ๐Ÿซถ.

Table of Contents ๐Ÿงš

1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
2.  Conventions Used in This Document . . . . . . . . . . . . . .   3
3.  STATUS Command and Response Extensions  . . . . . . . . . . .   3
4.  Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . .   5
5.  Security Considerations . . . . . . . . . . . . . . . . . . .   5
6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   5
7.  Normative References  . . . . . . . . . . . . . . . . . . . .   5
Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .   6
Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .   6

1. Introduction ๐Ÿฆ‹

Okay so this doc extends IMAP [IMAP4rev1] with the new "STATUS=SIZE" capability ๐Ÿ’–. Right now, if a client wants a mailbox's total size, it has to grab every message size one at a time using FETCH with the RFC822.SIZE data item ๐Ÿ˜ญ. Ew. STATUS=SIZE is the upgrade: it adds a new "SIZE" data item to STATUS, which gives the total size of all messages in the target mailbox, so you only need ONE STATUS command ๐Ÿงšโœจ. When LIST-STATUS [LIST-STATUS] is also around, you can grab SIZE for a bunch of mailboxes at once with just one LIST command ๐Ÿ”ฅ.

This is super useful for clients that don't cache the state of the message store, like most webmail clients ๐Ÿ’ป. Without this capability, those clients have to fetch every message size from the server whenever they need one mailbox's size ๐Ÿฅฒ. Picture a user who wants detailed quota usage for each mailbox to see which ones are hogging storage ๐Ÿ‘€. With that info they can see which mailboxes need a cleanup to lower their quota usage ๐Ÿงน. The QUOTA capability [QUOTA] doesn't help here, because QUOTAROOT only reports STORAGE usage for a whole quota root, not for each mailbox inside it ๐Ÿ’€.

2. Conventions Used in This Document ๐ŸŒธ

In the examples, "C:" marks lines sent by a client connected to a server, and "S:" marks lines sent by the server to the client ๐Ÿ’….

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this doc are read as BCP 14 [KEYWORDS] [KEYWORDS2] ONLY when they're in all capitals like shown here ๐ŸŽ€. Lowercase is just normal English, bestie ๐Ÿซถ.

3. STATUS Command and Response Extensions ๐Ÿ‘‘

This extension defines ONE new status data item for the STATUS command and response ๐Ÿ’–:

SIZE ๐ŸŒˆ

The total size of the mailbox in octets ๐Ÿ“ฆ. It doesn't have to be an exact value, but it MUST be equal to or greater than the sum of the RFC822.SIZE FETCH message data item [IMAP4rev1] of all messages in the mailbox ๐Ÿงฎ. If QUOTA [QUOTA] is also supported, this value SHOULD be equal to the storage usage value used to enforce the STORAGE resource limit for this mailbox ๐Ÿ’…. That way, the client can directly infer the quota usage ๐Ÿงš.

Since a mailbox's total storage size can easily go over 4 GB ๐Ÿ˜ณ, clients MUST be able to receive 63-bit SIZE data item values ๐Ÿ’ช. The message size is capped at 63 bits instead of 64 to make implementations on various platforms (like Java) easier ๐Ÿ“.

Example:

C: A01 STATUS frop (MESSAGES SIZE UIDNEXT)
S: * STATUS frop (MESSAGES 8 SIZE 44421 UIDNEXT 242344)
S: A01 OK STATUS completed

The same info can be gotten using the following commands, albeit less efficiently ๐Ÿ™ˆ:

C: A02 SELECT "frop"
S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
S: * 8 EXISTS
S: * 1 RECENT
S: * OK [UNSEEN 7] First unseen.
S: * OK [UIDVALIDITY 1364851417] UIDs valid
S: * OK [UIDNEXT 242344] Predicted next UID
S: * OK [HIGHESTMODSEQ 3914] Highest
S: A02 OK [READ-WRITE] Select completed.
C: A03 FETCH 1:* (RFC822.SIZE)
S: * 1 FETCH (RFC822.SIZE 3224)
S: * 2 FETCH (RFC822.SIZE 1222)
S: * 3 FETCH (RFC822.SIZE 444)
S: * 4 FETCH (RFC822.SIZE 4516)
S: * 5 FETCH (RFC822.SIZE 544)
S: * 6 FETCH (RFC822.SIZE 922)
S: * 7 FETCH (RFC822.SIZE 31126)
S: * 8 FETCH (RFC822.SIZE 2423)
S: A03 OK Fetch completed.

When LIST-STATUS [LIST-STATUS] is also available, STATUS can be combined with LIST to be even more efficient ๐Ÿ”ฅ. That means you can get the sizes of many mailboxes with just one LIST command ๐Ÿงš.

Example:

C: A04 LIST "" % RETURN (STATUS (MESSAGES SIZE))
S: * LIST () "." "INBOX"
S: * STATUS "INBOX" (MESSAGES 17 SIZE 16234)
S: * LIST () "." "frop"
S: * STATUS "frop" (MESSAGES 8 SIZE 44421)
S: A04 OK List completed.

4. Formal Syntax ๐Ÿ’œ

This syntax spec augments the grammar in [IMAP4rev1] and [IMAP4-ABNF] ๐Ÿ“. It uses ABNF [ABNF] notation. Anything not defined here comes from [IMAP4rev1] and [IMAP4-ABNF] ๐Ÿซถ.

capability     =/ "STATUS=SIZE"

status-att     =/ "SIZE"

status-att-val =/ "SIZE" SP number64

number64       = 1*DIGIT
                 ; Unsigned 63-bit integer
                 ; (0 <= n <= 9,223,372,036,854,775,807)

5. Security Considerations ๐Ÿ”

Okay, security time, and I'm being serious ๐Ÿซข. There are no known additional security issues with this extension beyond the ones already described for the base protocol [IMAP4rev1] and the LIST-STATUS extension [LIST-STATUS] ๐Ÿ›ก๏ธ. Nothing new to panic about, but don't skip the base protocol's own security notes either ๐Ÿ’€.

6. IANA Considerations ๐ŸŒˆ

IANA has added "STATUS=SIZE" to the "IMAP Capabilities" registry at <http://www.iana.org/assignments/imap-capabilities> ๐Ÿฆ‹.

7. Normative References ๐Ÿ“š

[ABNF]     Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
           Specifications: ABNF", STD 68, RFC 5234,
           DOI 10.17487/RFC5234, January 2008,
           <https://www.rfc-editor.org/info/rfc5234>.

[IMAP4-ABNF]
           Melnikov, A. and C. Daboo, "Collected Extensions to IMAP4
           ABNF", RFC 4466, DOI 10.17487/RFC4466, April 2006,
           <https://www.rfc-editor.org/info/rfc4466>.

[IMAP4rev1]
           Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
           4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003,
           <https://www.rfc-editor.org/info/rfc3501>.

[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119,
           DOI 10.17487/RFC2119, March 1997,
           <https://www.rfc-editor.org/info/rfc2119>.

[KEYWORDS2]
           Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
           2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
           May 2017, <https://www.rfc-editor.org/info/rfc8174>.

[LIST-STATUS]
           Melnikov, A. and T. Sirainen, "IMAP4 Extension for
           Returning STATUS Information in Extended LIST", RFC 5819,
           DOI 10.17487/RFC5819, March 2010,
           <https://www.rfc-editor.org/info/rfc5819>.

[QUOTA]    Myers, J., "IMAP4 QUOTA extension", RFC 2087,
           DOI 10.17487/RFC2087, January 1997,
           <https://www.rfc-editor.org/info/rfc2087>.

Acknowledgements ๐Ÿซถ

Huge thanks to Bron Gondwana, Alexey Melnikov, Stan Kalisch, and Michael Slusarz for reviews and suggestions ๐Ÿ’–.

Author's Address ๐Ÿฆ‹

Stephan Bosch Dovecot Oy Lars Sonckin Kaari 12 Espoo 02600 Finland

Email: stephan.bosch@dovecot.fi ๐Ÿ’Œ

๐Ÿ“ฆ where this page comes from