mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-05 18:58:02 -05:00
IMAP: fix invalid message header filter
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2150 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b3f60318e0
commit
c035b094c4
@ -1086,9 +1086,15 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
try {
|
||||
String messageHeaders = getItemProperty(permanentUrl, "messageheaders");
|
||||
if (messageHeaders != null) {
|
||||
final String MS_HEADER = "Microsoft Mail Internet Headers Version 2.0\r\n";
|
||||
final String MS_HEADER = "Microsoft Mail Internet Headers Version 2.0";
|
||||
if (messageHeaders.startsWith(MS_HEADER)) {
|
||||
messageHeaders = messageHeaders.substring(MS_HEADER.length());
|
||||
if (messageHeaders.charAt(0) == '\r') {
|
||||
messageHeaders = messageHeaders.substring(1);
|
||||
}
|
||||
if (messageHeaders.charAt(0) == '\n') {
|
||||
messageHeaders = messageHeaders.substring(1);
|
||||
}
|
||||
}
|
||||
// workaround for messages in Sent folder
|
||||
if (messageHeaders.indexOf("From:") < 0) {
|
||||
|
@ -1941,34 +1941,4 @@ public class ImapConnection extends AbstractConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public void testInvalidHeaders() throws MessagingException {
|
||||
String messageHeaders = "Microsoft Mail Internet Headers Version 2.0\r\n" +
|
||||
"Received: from mail.litwareinc.com ([10.54.108.101]) by mail.proseware.com with Microsoft SMTPSVC(6.0.3790.0);\r\n" +
|
||||
"Wed, 12 Dec 2007 13:39:22 -0800\r\n" +
|
||||
"Received: from mail ([10.54.108.23] RDNS failed) by mail.litware.com with Microsoft SMTPSVC(6.0.3790.0);\r\n" +
|
||||
"Wed, 12 Dec 2007 13:38:49 -0800\r\n" +
|
||||
"From: \"Kelly J. Weadock\" <kelly@litware.com>\n" +
|
||||
"To: <anton@proseware.com>\n" +
|
||||
"Cc: <tim@cpandl.com>\n" +
|
||||
"Subject: Review of staff assignments\n" +
|
||||
"Date: Wed, 12 Dec 2007 13:38:31 -0800\n" +
|
||||
"MIME-Version: 1.0\n" +
|
||||
"Content-Type: multipart/mixed;\n" +
|
||||
"X-Mailer: Microsoft Office Outlook, Build 12.0.4210\n" +
|
||||
"X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165\n" +
|
||||
"Thread-Index: AcON3CInEwkfLOQsQGeK8VCv3M+ipA==\n" +
|
||||
"Return-Path: kelly@litware.com\n" +
|
||||
"Message-ID: <MAILbbnewS5TqCRL00000013@mail.litware.com>\n" +
|
||||
"X-OriginalArrivalTime: 12 Dec 2007 21:38:50.0145 (UTC)";
|
||||
final String MS_HEADER = "Microsoft Mail Internet Headers Version 2.0\r\n";
|
||||
if (messageHeaders.startsWith(MS_HEADER)) {
|
||||
messageHeaders = messageHeaders.substring(MS_HEADER.length());
|
||||
}
|
||||
Enumeration enumeration = new InternetHeaders(new ByteArrayInputStream(messageHeaders.getBytes())).getAllHeaderLines();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
System.out.println(enumeration.nextElement());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user