[evolution-data-server] Bug 621262 - Fix fetch of large mails from broken servers like Exchange



commit 9714c064625c8de1caf3c2a4f582115684e8ec3c
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri Jun 11 01:42:59 2010 +0100

    Bug 621262 - Fix fetch of large mails from broken servers like Exchange

 camel/providers/imapx/camel-imapx-server.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 07c622c..1bb4a79 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2605,8 +2605,13 @@ imapx_command_fetch_message_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 		failed = TRUE;
 		job->u.get_message.body_len = -1;
 	} else  if (job->u.get_message.use_multi_fetch) {
-
-		if (!failed && job->u.get_message.fetch_offset <= job->u.get_message.size) {
+		gsize really_fetched = CAMEL_SEEKABLE_STREAM(job->u.get_message.stream)->position;
+		/* Don't automatically stop when we reach the reported message
+		   size -- some crappy servers (like Microsoft Exchange) have
+		   a tendency to lie about it. Keep going (one request at a 
+		   time) until the data actually stop coming. */
+		if (job->u.get_message.fetch_offset < job->u.get_message.size ||
+		    job->u.get_message.fetch_offset == really_fetched) {
 			camel_imapx_command_free (ic);
 			if (job->op)
 				camel_operation_progress (job->op, (job->u.get_message.fetch_offset *100)/job->u.get_message.size);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]