rfc-9394

IMAP PARTIAL Extension for Paged SEARCH and FETCH

A. Melnikov, A. P. Achuthan, V. Nagulakonda, L. Alves
date2023-06 streamIETF areaart wgextra statusPROPOSED STANDARD pages10 canonicalhttps://www.rfc-editor.org/rfc/rfc9394 doi10.17487/RFC9394
The PARTIAL extension of the Internet Message Access Protocol (see RFCs 3501 and 9051) allows clients to limit the number of SEARCH results returned, as well as to perform incremental (paged) searches. This also helps servers to optimize resource usage when performing searches. This document extends the PARTIAL SEARCH return option originally specified in RFC 5267. It also clarifies some interactions between RFC 5267 and RFCs 4731 and 9051. This document updates RFCs 4731 and 5267.

updates

Extracted elements (21)

design-rationale §3.1

Negative indexing (prepending "-" to range values) was introduced to allow clients to request the most recent results first. The RFC notes this syntax explicitly helps server implementations optimize their SEARCHes by avoiding full-result materialization.

email

design-rationale §3.1

Result indexing in PARTIAL is 1-based and intentionally mirrors IMAP message sequence numbers, so that clients can use familiar offset arithmetic when paginating through large search results.

email

interoperability-note §3.4

The PARTIAL FETCH modifier can be combined with the CHANGEDSINCE (CONDSTORE) FETCH modifier. The server first selects the messages in the PARTIAL range and then returns only flag changes with MODSEQ higher than the specified value. The order of PARTIAL and CHANGEDSINCE modifiers in the command is not significant.

email

interoperability-note §1

This extension is compatible with both IMAP4rev1 (RFC 3501) and IMAP4rev2 (RFC 9051). Section 3.2 applies only if the server advertises "PARTIAL" or "CONTEXT=SEARCH" together with "ESEARCH" and/or IMAP4rev2.

email

interoperability-note §3.2

When SAVE and PARTIAL are combined with COUNT, the PARTIAL and COUNT options are returned and the "$" marker always contains references to all messages found by the SEARCH or UID SEARCH command, not just the PARTIAL subset.

email

interoperability-note §3.2

When SAVE and PARTIAL are combined with MIN or MAX (without COUNT), the PARTIAL and MIN/MAX results are returned, and the "$" marker contains references to all PARTIAL messages plus the MIN/MAX message. When combined with both MIN and MAX (without COUNT), all three result options are returned and "$" includes PARTIAL, MIN, and MAX messages.

email

interoperability-note §3.2

When SAVE and PARTIAL result options are combined without MIN, MAX, or COUNT, the corresponding PARTIAL results are returned and the "$" marker contains references to all messages returned by the PARTIAL option.

email

normative-requirement §3.1 MUST NOT

A single command MUST NOT contain more than one PARTIAL or ALL search return option; that is, either one PARTIAL, one ALL, or neither PARTIAL nor ALL is allowed in the same SEARCH command.

email

normative-requirement §3.1 MUST

For SEARCH results, the entire list of results MUST be ordered in mailbox order — that is, in UID or message sequence number order.

email

normative-requirement §4 MUST

Implementations MUST accept capability and keyword strings in a case-insensitive fashion, as the use of uppercase or lowercase characters in token definitions is for editorial clarity only.

email

protocol-element §3

An IMAP server advertises support for the PARTIAL extension by including the "PARTIAL" capability in the CAPABILITY response or response code.

email, registry

protocol-element §3.1

Clients can direct the server to start a SEARCH from the latest matching message by prepending "-" to the index. For example, -1 is the last message and -2 is next to last; "PARTIAL -1:-100" returns the 100 most recent results.

email

protocol-element §3.3

The PARTIAL extension extends the UID FETCH command with a PARTIAL FETCH modifier, which has the same syntax as the PARTIAL SEARCH result option. It instructs the server to return FETCH results only for messages in the specified range, useful when the sequence-set parameter includes an unknown number of messages.

email

protocol-element §3.1

The PARTIAL SEARCH return option causes the server to provide in an ESEARCH response a subset of results denoted by the sequence range given as a mandatory argument. The first result (lowest matching UID) is 1, so "PARTIAL 1:500" returns the first 500 results and "PARTIAL 501:1000" the second 500.

email

protocol-element §3.1

When a PARTIAL range references results that do not exist, the server returns only the results that are in the set. If the whole range references no existing results, the server returns the special value "NIL" in the PARTIAL return data item instead of a sequence set.

email

registry §6.1

IANA has added the "PARTIAL" capability to the "IMAP Capabilities" registry with RFC 9394 as the reference. IMAP4 capabilities are registered by publishing a Standards Track or IESG-approved Informational or Experimental RFC.

email, registry

security-consideration §5

The extension reduces both server work and data returned to the client, likely reducing memory usage. However, because this is new code in both client and server implementations, rigorous testing is required to avoid introducing new implementation bugs.

email, security

security-consideration §5

The PARTIAL extension does not change the underlying security considerations of IMAP4rev1 or IMAP4rev2. The authors and reviewers believe no new security issues are introduced by these additional capabilities.

email, security

wire-format §4

The partial-range-first production is defined as "nz-number ":" nz-number", requesting results from oldest (lowest UIDs) to newest. A range 500:400 is treated the same as 400:500; the range cannot contain "*".

email

wire-format §4

The partial-range-last production is defined as "MINUS nz-number ":" MINUS nz-number" (e.g., -500:-400), requesting results from newest (highest UIDs) to oldest. A range -500:-400 is equivalent to -400:-500.

email

wire-format §4

The ret-data-partial response format is "PARTIAL" SP "(" partial-range SP partial-results ")", where partial-range echoes the requested range and partial-results is either a sequence-set or "NIL" when no results correspond to the range.

email