[Dovecot] mozilla, error in imap command uid

Timo Sirainen tss at iki.fi
Fri Dec 3 19:49:16 EET 2004


On 3.12.2004, at 19:06, Nicolas.Kowalski at imag.fr wrote:

>> I finally checked this myself. The problem is that Thunderbird 
>> requires that
>> the RFC822.SIZE reply comes before BODY[HEADER.FIELDS(..)], otherwise 
>> it
>> breaks this way. I'd rather not change the order in which Dovecot 
>> returns the
>> replies, so getting Thunderbird people to fix it would be good idea.
>
> Others servers (uw, cyrus) return these replies "correctly" (ie. the 
> way
> tb/mozilla understand them correctly), so why not dovecot ?

Others reply like:

* 1 FETCH (UID 1 RFC822.SIZE 123456 BODY.PEEK[HEADER.FIELDS (xxx)]{100}
From: foo
To: bar
)

Dovecot replies like:

* 1 FETCH (BODY.PEEK[HEADER.FIELDS (xxx)]{100}
From: foo
To: bar
  UID 1 RFC822.SIZE 123456)

Both are valid from IMAP point of view so it's Thunderbird's problem 
that it doesn't parse the replies correctly.

It's a bit easier for Dovecot to reply the way it does now, and I'd 
rather not change it just because one client has problems reading it 
correctly. This patch would anyway fix it:

diff -u -r1.15 imap-fetch-body.c
--- imap-fetch-body.c	20 Oct 2004 18:09:32 -0000	1.15
+++ imap-fetch-body.c	3 Dec 2004 16:39:41 -0000
@@ -824,13 +824,23 @@
  static int fetch_rfc822_size(struct imap_fetch_context *ctx, struct 
mail *mail,
  			     void *context __attr_unused__)
  {
+	const char *str;
  	uoff_t size;

  	size = mail->get_virtual_size(mail);
  	if (size == (uoff_t)-1)
  		return -1;

-	str_printfa(ctx->cur_str, "RFC822.SIZE %"PRIuUOFF_T" ", size);
+	if (ctx->first)
+		ctx->first = FALSE;
+	else {
+		if (o_stream_send(ctx->client->output, " ", 1) < 0)
+			return -1;
+	}
+
+	str = t_strdup_printf("RFC822.SIZE %"PRIuUOFF_T, size);
+	if (o_stream_send_str(ctx->client->output, str) < 0)
+		return -1;
  	return 1;
  }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20041203/f1fea5b9/attachment-0001.bin>


More information about the dovecot mailing list