ietf-corpus

rfc-5162

IMAP4 Extensions for Quick Mailbox Resynchronization

A. Melnikov, D. Cridland, C. Wilson
date2008-03 streamIETF areaapp wglemonade statusPROPOSED STANDARD pages23 canonicalhttps://www.rfc-editor.org/rfc/rfc5162 doi10.17487/RFC5162 errataview
This document defines an IMAP4 extension, which gives an IMAP client the ability to quickly resynchronize any previously opened mailbox as part of the SELECT command, without the need for server-side state or additional client round-trips. This extension also introduces a new response that allows for a more compact representation of a list of expunged messages (and always includes the Unique Identifiers (UIDs) expunged). [STANDARDS-TRACK]

obsoleted by

Extracted elements (28)

design-rationale §4.3

Implementations storing mod-sequences for expunged messages should limit queue size and expire older records to avoid storage problems. In the worst case, storing <min UID, max UID, mod-sequence> triples for a mailbox could require nearly 64GB of storage. A separate 'highest expired mod-sequence' value is maintained to handle expired records correctly.

email

design-rationale §1

QRESYNC extends SELECT to perform resynchronization in a single round-trip, avoiding the need for clients to issue separate UID FETCH and UID SEARCH commands that CONDSTORE-only clients require. This is particularly useful for mobile clients experiencing frequent disconnects due to battery life or signal strength.

email

design-rationale §3.1

The message sequence match data parameter allows a client to provide a small sample of sequence number-to-UID mappings. The server uses this to restrict the range for which it provides expunged message information, potentially saving substantial bandwidth when expunges have not happened or occur only toward the end of the mailbox.

email

design-rationale §3.6

The VANISHED response uses UIDs instead of message numbers and can report multiple expunged messages in a single response, unlike the EXPUNGE response which reports one message at a time using sequence numbers. This saves bandwidth and is more convenient for clients that only use UIDs.

email

interoperability-note §1

For compatibility with clients that only support CONDSTORE, servers SHOULD advertise CONDSTORE in the CAPABILITY response as well. A CONDSTORE-only client may incur an extra unneeded round-trip when resynchronizing mailboxes that had messages expunged but no flag changes.

email

normative-requirement §1 MUST

A client making use of this extension MUST issue 'ENABLE QRESYNC' once it is authenticated. A server MUST respond with a tagged BAD response if the QRESYNC parameter to SELECT/EXAMINE or the VANISHED UID FETCH modifier is specified and the client hasn't issued 'ENABLE QRESYNC' in the current connection.

email

normative-requirement §3.1 MUST

A server that doesn't support persistent storage of mod-sequences for the mailbox MUST send the OK untagged response including the NOMODSEQ response code and MUST ignore the remaining QRESYNC parameters, behaving as if no dynamic message data changed.

email

normative-requirement §3.2 MUST

A server that receives a mod-sequence smaller than the smallest expunged mod-sequence it remembers minus one MUST behave as if it was requested to report all expunged messages from the provided UID set parameter.

email

normative-requirement §3.6 MUST NOT

A VANISHED response MUST NOT be sent when no command is in progress, nor while responding to a FETCH, STORE, or SEARCH command. A VANISHED response MAY be sent during a UID command, but MUST NOT be sent during a UID SEARCH command that contains message numbers in the search criteria.

email

normative-requirement §3.2 MUST

Any VANISHED (EARLIER) responses MUST be returned before any FETCH responses, as otherwise the client might get confused about how message numbers map to UIDs.

email

normative-requirement §1 MUST

Each mailbox that supports persistent storage of mod-sequences MUST increment the per-mailbox mod-sequence when one or more messages are expunged due to EXPUNGE, UID EXPUNGE, or CLOSE. The server MUST associate the incremented mod-sequence with the UIDs of the expunged messages.

email

normative-requirement §3.4 MUST

For the CLOSE command, if at least one message was permanently removed, the server MUST increment the per-mailbox mod-sequence, MUST remember the incremented mod-sequence and corresponding UID for each removed message, and MUST send the updated HIGHESTMODSEQ in the tagged OK response. No untagged EXPUNGE or VANISHED responses are sent for CLOSE.

email

normative-requirement §3.1 MUST

If the provided UIDVALIDITY doesn't match the UIDVALIDITY for the mailbox being opened, the server MUST ignore the remaining QRESYNC parameters and behave as if no dynamic message data changed.

email

normative-requirement §3.3 MUST

If the server is capable of storing modification sequences and at least one message was permanently removed by EXPUNGE, it MUST increment the per-mailbox mod-sequence, MUST remember the incremented mod-sequence and corresponding UID for each removed message, and MUST send the updated mod-sequence using the HIGHESTMODSEQ response code in the tagged OK response.

email

normative-requirement §3.6 SHOULD

Once a client has issued 'ENABLE QRESYNC', the server SHOULD use the VANISHED response without the EARLIER tag instead of the EXPUNGE response, and SHOULD continue using VANISHED in lieu of EXPUNGE for the duration of the connection.

email

normative-requirement §3.6 MUST

Servers MUST NOT report UIDs resulting from UID FETCH (VANISHED) or SELECT/EXAMINE (QRESYNC) in the same VANISHED response as UIDs of messages expunged now. Instead, the server MUST send separate VANISHED responses: one with EARLIER and one without.

email

normative-requirement §5 MUST

The client MUST cache the HIGHESTMODSEQ value received on mailbox opening. The client MUST update its copy of HIGHESTMODSEQ whenever the server sends a subsequent HIGHESTMODSEQ OK response code. If the client receives NOMODSEQ on SELECT/EXAMINE (QRESYNC), it MUST remove the cached HIGHESTMODSEQ value.

email

normative-requirement §5 MUST

The client MUST NOT update its HIGHESTMODSEQ with a MODSEQ FETCH data item value as soon as it is received; instead it should wait until a tagged response and use the highest value among all MODSEQ FETCH data items received since the last tagged response, if that value is bigger than the current cached HIGHESTMODSEQ.

email

normative-requirement §3.1 MUST

The server sends the client pending flag changes (using FETCH responses that MUST contain UIDs) and expunges that have occurred since the provided modification sequence. FETCH responses MUST contain UIDs.

email

normative-requirement §3.6 MUST

When a client sees a VANISHED EARLIER response, it MUST NOT decrement message sequence numbers for each successive message in the mailbox. A VANISHED response without EARLIER MUST cause the client to decrement message sequence numbers.

email

protocol-element §3.7

The CLOSED response code (no parameters) MUST be returned by the server when the currently selected mailbox is closed implicitly using the SELECT/EXAMINE command on another mailbox. It serves as a boundary between responses for the previously opened mailbox and the newly selected mailbox.

email

protocol-element §1

The QRESYNC extension is present if an IMAP4 server returns 'QRESYNC' as one of the supported capabilities to the CAPABILITY command. Servers supporting this extension MUST implement and advertise support for the ENABLE IMAP extension. The presence of 'QRESYNC' capability implies support for CONDSTORE even if CONDSTORE is not advertised.

email

protocol-element §3.1

The QRESYNC parameter to SELECT/EXAMINE has four arguments: the last known UIDVALIDITY, the last known modification sequence, an optional set of known UIDs, and an optional parenthesized list of known sequence ranges and their corresponding UIDs.

email

protocol-element §3.6

The VANISHED response reports that specified UIDs have been permanently removed from the mailbox. It can return information about multiple messages and returns UIDs instead of message numbers. It has two forms: one with the EARLIER tag (caused by UID FETCH VANISHED or SELECT/EXAMINE QRESYNC) and one without (caused by EXPUNGE/UID EXPUNGE or expunges in other connections).

email

protocol-element §3.2

The VANISHED UID FETCH modifier instructs the server to report messages from the UID set parameter that have been expunged and whose associated mod-sequence is larger than the specified mod-sequence. It MUST only be specified together with the CHANGEDSINCE UID FETCH modifier and is NOT allowed with a plain FETCH command.

email

registry §8

This document defines the QRESYNC IMAP capability, which IANA has added to the IMAP4 capabilities registry at http://www.iana.org/assignments/imap4-capabilities.

email, registry

security-consideration §7

It is important to thoroughly test clients and servers implementing this extension, as it changes how the server reports expunged messages to the client. This document does not raise any new security concerns not already raised by CONDSTORE or RFC 3501.

email, security

wire-format §6

The QRESYNC select-param is encoded as: 'QRESYNC' SP '(' uidvalidity SP mod-sequence-value [SP known-uids] [SP seq-match-data] ')'. The seq-match-data is a parenthesized pair of known-sequence-set and known-uid-set in ascending order. The expunged-resp is 'VANISHED' [SP '(EARLIER)'] SP known-uids.

email