1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Configure MIME4J to not die when there are long header lines or a large message header

This commit is contained in:
Jesse Vincent 2011-02-01 20:48:20 +00:00
parent 4d9f779301
commit ff0f517cbb

View File

@ -9,6 +9,7 @@ import org.apache.james.mime4j.stream.RawField;
import org.apache.james.mime4j.parser.ContentHandler;
import org.apache.james.mime4j.io.EOLConvertingInputStream;
import org.apache.james.mime4j.parser.MimeStreamParser;
import org.apache.james.mime4j.stream.MimeEntityConfig;
import org.apache.james.mime4j.dom.field.DateTimeField;
import org.apache.james.mime4j.dom.field.Field;
import org.apache.james.mime4j.field.DefaultFieldParser;
@ -76,7 +77,11 @@ public class MimeMessage extends Message
mBody = null;
MimeStreamParser parser = new MimeStreamParser();
MimeEntityConfig parserConfig = new MimeEntityConfig();
parserConfig.setMaxHeaderLen(-1); // The default is a mere 10k
parserConfig.setMaxLineLen(-1); // The default is 1000 characters. Some MUAs generate
// REALLY long References: headers
MimeStreamParser parser = new MimeStreamParser(parserConfig);
parser.setContentHandler(new MimeMessageBuilder());
try
{