序列号更改时IMAP获取命令竞争条件

时间:2014-04-24 17:35:10

标签: email imap

我正试图通过RFC 3501来确定从序列号中获取时会发生什么,但是在响应之前有一个CREATE或EXPUNGE命令。 e.g。

> C: t fetch 32 rfc822.size
> S: * 32 FETCH (RFC822.SIZE 4085)

很简单,但是:

> C: t fetch 32 rfc822.size
> S: * 12 EXPUNGE
> S: * 32 EXISTS
> S: * 31 FETCH (RFC822.SIZE 4085)

31是否引用新序列号或fetch中引用的序列号?

2 个答案:

答案 0 :(得分:2)

RFC 3501的第7.4.1节特别包含以下语言:

  An EXPUNGE response MUST NOT be sent when no command is in
  progress, nor while responding to a FETCH, STORE, or SEARCH
  command.  This rule is necessary to prevent a loss of
  synchronization of message sequence numbers between client and
  server.  A command is not "in progress" until the complete command
  has been received; in particular, a command is not "in progress"
  during the negotiation of command continuation.

这特别禁止这个例子。它不能单方面发送(“当没有命令正在进行时绝不能发送”),并且它不能作为对FETCH的响应发送(“也不是在响应FETCH,STORE或SEARCH命令时”)。

另见5.5,其中包含有关多个命令正在进行时的竞争条件的一些信息。当其他类型的命令正在进行时,禁止客户端发送纯FETCH,STORE或SEARCH,反之亦然。

答案 1 :(得分:1)

您的答案应该是显而易见的 - 对于删除后的响应中的31,引用除“当前”序列号31之外的其他内容将意味着IMAP服务器正在维护每个命令点的序列号索引-时间。显然,IMAP协议不需要服务器的部分工作。

另外请注意,严格来说,未标记的响应与fetch命令无关;该协会只是一个建议。