MBOX-Line: From mrc at CAC.Washington.EDU  Thu Jun 22 08:33:51 2006
To: imap-protocol@u.washington.edu
From: Mark Crispin <mrc@CAC.Washington.EDU>
Date: Fri Jun  8 12:34:37 2018
Subject: [Imap-protocol] questions regarding number of replies to an
	IMAPv4rev1 request.
In-Reply-To: <CF406A890CCCA14E9543EAFBE3A2C2D10712AA@exchindia2.starentnetworks.com>
References: <CF406A890CCCA14E9543EAFBE3A2C2D10712AA@exchindia2.starentnetworks.com>
Message-ID: <Pine.OSX.4.64.0606220826490.1066@pangtzu.panda.com>

On Thu, 22 Jun 2006, Patankar, Sujay wrote:
> 1:  Since there can be multiple untagged replies to an IMAP request, and
>    I've seen in the field that sometimes there is no tagged response at
>    all, how do I make sure that there will be no more replies to a
>    particular IMAP request?
>    e.g. I have seen a LIST request getting three untagged LIST responses,
>    and no tagged response at all.

A server that operates the way that you claim would not work at all with 
most IMAP clients.

A more likely explanation is that either your observations are incomplete 
(perhaps due to a bug in the program recording those observations) or you 
misinterpreted what you observed.  Please review both your recording 
program and your observations.

Note that TCP is a stream.  There is no reason to believe that the tagged 
OK would be in the same segment as the untagged responses.  It may be in a 
later segment.  Thus, it is generally incorrect to look at TCP segments at 
all, and instead to consider the overall stream.

> 2:  Is there only one tagged response to a request, or can there be more
>    than one?

There is one, and only one, tagged response to a request.

> 3:  When there are two or more requests in the pipeline, and I receive an
>    untagged response, to which of the requests does it belong?

You can not do so, and in general there is no reason why you need to do 
so.  The entire point of the untagged data model in IMAP is that the 
client maintain a state of the mailbox, possibly incomplete.  Untagged 
responses are effectively commands from the server to the client to 
load/update that state in the client.

This does mean that there are some commands, most notably LIST, LSUB, 
SEARCH, SORT, and THREAD, in which you probably do not want to have more 
than one such command in progress at a time unless you desire that the 
effective output be combined.

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.

