From f4ad37ee6fedaf1ae1d36bbc292d0d34ea2b94b9 Mon Sep 17 00:00:00 2001 From: mguessan Date: Wed, 10 Nov 2010 21:21:41 +0000 Subject: [PATCH] IMAP: fix 3106803, IMAP client stuck scanning Inbox, fix header and body fetch in same request git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1541 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/imap/ImapConnection.java | 2 +- src/test/davmail/imap/TestImap.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/davmail/imap/ImapConnection.java b/src/java/davmail/imap/ImapConnection.java index e677c315..9d3ecc77 100644 --- a/src/java/davmail/imap/ImapConnection.java +++ b/src/java/davmail/imap/ImapConnection.java @@ -678,7 +678,7 @@ public class ImapConnection extends AbstractConnection { // get full param if (param.indexOf('[') >= 0) { StringBuilder paramBuffer = new StringBuilder(param); - while (paramTokens.hasMoreTokens() && param.indexOf(']') < 0) { + while (paramTokens.hasMoreTokens() && paramBuffer.indexOf("]") < 0) { paramBuffer.append(' ').append(paramTokens.nextToken()); } param = paramBuffer.toString(); diff --git a/src/test/davmail/imap/TestImap.java b/src/test/davmail/imap/TestImap.java index 2f9924b8..c6364832 100644 --- a/src/test/davmail/imap/TestImap.java +++ b/src/test/davmail/imap/TestImap.java @@ -289,6 +289,11 @@ public class TestImap extends AbstractDavMailTestCase { assertEquals(". OK UID FETCH completed", readFullAnswer(".")); } + public void testHeaderBodyFetch() throws IOException { + writeLine(". UID FETCH " + messageUid + " (UID BODY.PEEK[HEADER.FIELDS (Content-Type Content-Transfer-Encoding)] BODY.PEEK[TEXT]<0.2048>)"); + assertEquals(". OK UID FETCH completed", readFullAnswer(".")); + } + public void testFetchInternalDate() throws IOException { writeLine(". UID FETCH " + messageUid + " (INTERNALDATE)"); assertEquals(". OK UID FETCH completed", readFullAnswer("."));