# HG changeset patch # User Timo Sirainen # Date 1486303844 -7200 # Node ID f2d8b1c3773ed09ec0bb56a660e9a03a16723ace # Parent c0f9d3f9bfd078be89e869a8581a6d1a7de501b2 imap: Don't send empty FETCH () on failure It violates IMAP RFC. Send FETCH (UID n) instead. diff -r c0f9d3f9bfd0 -r f2d8b1c3773e src/imap/imap-fetch.c --- a/src/imap/imap-fetch.c Mon Feb 06 11:02:46 2017 +0200 +++ b/src/imap/imap-fetch.c Sun Feb 05 16:10:44 2017 +0200 @@ -528,6 +528,14 @@ i_stream_unref(&state->cur_input); } + if (state->cur_first) { + /* Writing FETCH () violates IMAP RFC. It's a bit + troublesome to delay flushing of "FETCH (" with + non-buffered data, so we'll just fix this by giving + UID as the response. */ + str_printfa(state->cur_str, "UID %u", + state->cur_mail->uid); + } if (str_len(state->cur_str) > 0) { /* no non-buffered handlers */ if (imap_fetch_flush_buffer(ctx) < 0)