[Imap-protocol] Question on FETCH example in RFC3501

Philip Guenther guenther+imap at sendmail.com
Wed Jan 9 20:23:53 PST 2008


On Thu, 10 Jan 2008, Liam Clarke wrote:

> Thanks for that - my vague fear is that a poorly behaved server could

> mix responses to one request with responses for another, which

> probably betrays my lack of experience with IMAP servers.


It's not 100% clear to me what you mean by "mix responses to one requests
with responses for another". Can a server send back FETCH responses for
messages that you never asked about? Yes! Can it send back FETCH data
items that you never asked about? Yes! Indeed, those both commonly occur
for flags. For example, let's say the flags on messages 2 and 3 have
changed since the client last sent a command, and then it sends this:

a042 FETCH 2 RFC822.SIZE

The server may send back the following:
* 2 FETCH (RFC822.SIZE 123985 FLAGS (\seen \deleted))
* 3 FETCH (FLAGS (\seen \recent \deleted))
a042 Ok


IMAP FETCH is effectively a cache-filling protocol: the client asks for
whatever data that it wants but doesn't already have and is told when all
that data has been sent. However, the server may send additional,
unrequested data along the way in order to keep the client's cache up to
date. c.f. RFC 3501, section 5.2 for what servers are required and
expected to send without being asked.


Philip Guenther


More information about the Imap-protocol mailing list