committed to both branches
On Fri, 2005-03-18 at 19:25 -0500, Jeffrey Stedfast wrote:
> well, I don't know if it actually fixes it or not but this code looked
> sceptical, so... maybe.
>
> can't repro on tims laptop anymore and I'm tired and I want to go
> home... so here's a possible fix
>
> text/plain attachment (imap-too-soon.patch)
> ? 70425.patch
> ? imap-too-soon.patch
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/ChangeLog,v
> retrieving revision 1.13
> diff -u -r1.13 ChangeLog
> --- ChangeLog 15 Mar 2005 01:48:04 -0000 1.13
> +++ ChangeLog 19 Mar 2005 00:25:40 -0000
> @@ -1,3 +1,9 @@
> +2005-03-18 Jeffrey Stedfast <fejj novell com>
> +
> + * camel-imap-command.c (imap_read_untagged): Continue reading data
> + until we've read all the data (camel_stream_read() makes no
> + guarantee that it will read n bytes in a single call).
> +
> 2005-03-10 Jeffrey Stedfast <fejj novell com>
>
> * camel-imap-folder.c (imap_sync_online): READ-ONLY doesn't mean
> Index: camel-imap-command.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap/camel-imap-command.c,v
> retrieving revision 1.67
> diff -u -r1.67 camel-imap-command.c
> --- camel-imap-command.c 4 Feb 2005 03:09:22 -0000 1.67
> +++ camel-imap-command.c 19 Mar 2005 00:25:40 -0000
> @@ -413,7 +413,7 @@
> static char *
> imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
> {
> - int fulllen, ldigits, nread, i, sexp = 0;
> + int fulllen, ldigits, nread, n, i, sexp = 0;
> unsigned int length;
> GPtrArray *data;
> GString *str;
> @@ -456,18 +456,24 @@
> /* Read the literal */
> str = g_string_sized_new (length + 2);
> str->str[0] = '\n';
> - nread = camel_stream_read (store->istream, str->str + 1, length);
> - if (nread == -1) {
> - if (errno == EINTR)
> - camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
> - _("Operation cancelled"));
> - else
> - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
> - g_strerror (errno));
> - camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
> - g_string_free (str, TRUE);
> - goto lose;
> - }
> + nread = 0;
> +
> + do {
> + if ((n = camel_stream_read (store->istream, str->str + nread + 1, length - nread)) == -1) {
> + if (errno == EINTR)
> + camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
> + _("Operation cancelled"));
> + else
> + camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
> + g_strerror (errno));
> + camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
> + g_string_free (str, TRUE);
> + goto lose;
> + }
> +
> + nread += n;
> + } while (n > 0 && nread < length);
> +
> if (nread < length) {
> camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
> _("Server response ended too soon."));
--
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com - www.novell.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature