Quoting John Capo ([EMAIL PROTECTED]):
> Quoting Ken Murchison ([EMAIL PROTECTED]):
> > I don't think I was clear. With my proposal, we're well past "UPDATE".
> > I'm talking about cutting the command short after "(<flags>)". No
> > header_size or anything after.
>
> I guess I don't understand what you mean.
>
> It sure looks to me like cmd_upload() has to detect that the header
> size it is waiting for will not arrive and recover gracefully rather
> than sending a BAD that the client sees as the response for its
> next command. Patch attached.
The server needs to push the character back except on EOF, grrrr.
John Capo
--- cyrus-imapd-2.3.7/imap/sync_server.c Sun May 13 11:56:58 2007
+++ cyrus-imapd-2.3.7-abort-upload/imap/sync_server.c Tue May 15 20:05:57 2007
@@ -1870,13 +1870,27 @@
goto parse_err;
}
- message = sync_message_add(message_list, &item->uuid);
+ c = prot_getc(sync_in);
+
+ if (c != EOF)
+ prot_ungetc(c, sync_in);
+
+ if (c == EOF || !isdigit(c))
+ {
+ /* Make sure cache data flushed to disk before we commit */
+ sync_message_fsync(message_list);
+ sync_message_list_cache_flush(message_list);
+ sync_upload_list_free(&upload_list);
+ syslog(LOG_ERR, "IOERROR: UPLOAD ABORT");
+ return;
+ }
/* Parse Message (header size, content lines, cache, message body
*/
if ((c = getastring(sync_in, sync_out, &arg)) != ' ') {
err = "Invalid Header Size";
goto parse_err;
}
+ message = sync_message_add(message_list, &item->uuid);
message->hdr_size = sync_atoul(arg.s);
if ((c = getastring(sync_in, sync_out, &arg)) != ' ') {