IMAP: fix missing headers with Outlook

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2141 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-06-12 16:38:05 +00:00
parent 0f65595a7f
commit 7a371723ee
2 changed files with 32 additions and 1 deletions

View File

@ -1964,7 +1964,12 @@ public abstract class ExchangeSession {
public Enumeration getMatchingHeaderLines(String[] headerNames) throws MessagingException, IOException {
Enumeration result = getMatchingHeaderLinesFromHeaders(headerNames);
if (result == null) {
result = getMimeMessage().getMatchingHeaderLines(headerNames);
if (headerNames == null) {
result = getMimeMessage().getAllHeaderLines();
} else {
result = getMimeMessage().getMatchingHeaderLines(headerNames);
}
}
return result;
}

View File

@ -515,4 +515,30 @@ public class TestImap extends AbstractImapTestCase {
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
public void testDoubleHeaderBodyFetch() throws IOException {
writeLine(". SELECT INBOX");
assertEquals(". OK [READ-WRITE] SELECT completed", readFullAnswer("."));
writeLine(". UID FETCH 51241 BODY.PEEK[TEXT]");
String line = socketReader.readLine();
int size = 0;
while (!line.startsWith(".")) {
line = socketReader.readLine();
size += line.length()+2;
}
System.out.println("actual size "+size);
}
public void testBodyHeaderFetch() throws IOException {
writeLine(". SELECT INBOX");
assertEquals(". OK [READ-WRITE] SELECT completed", readFullAnswer("."));
writeLine(". UID FETCH 1:* BODY[HEADER]");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
public void testOutlookHeaderFetch() throws IOException {
writeLine(". SELECT INBOX");
assertEquals(". OK [READ-WRITE] SELECT completed", readFullAnswer("."));
writeLine(". UID FETCH 1:* (UID FLAGS RFC822.SIZE BODY.PEEK[HEADER] INTERNALDATE)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
}