[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389510#comment-16389510 ] Raffaele Gambelli commented on MIME4J-265: -- Thank you, I was using core 0.7.2 > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli >Priority: Major > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389375#comment-16389375 ] Tellier Benoit commented on MIME4J-265: --- Do you use Mime4J 0.8.1 ? It's available (at least for this version) and we actively use this static method in the James server. > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli >Priority: Major > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389364#comment-16389364 ] Raffaele Gambelli commented on MIME4J-265: -- Thanks Tellier but I cannot found MimeConfig.custom() method... > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli >Priority: Major > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16385746#comment-16385746 ] Tellier Benoit commented on MIME4J-265: --- Hi, You just need to pass a custom mime configuration to your message builder. For instance: {code:java} DefaultMessageBuilder defaultMessageBuilder = new DefaultMessageBuilder(); defaultMessageBuilder.setMimeEntityConfig(MimeConfig.custom() .setMaxContentLen(-1) .setMaxHeaderCount(-1) .setMaxHeaderLen(-1) .setMaxHeaderCount(-1) .setMaxLineLen(-1) .build()); defaultMessageBuilder.setDecodeMonitor(DecodeMonitor.SILENT); Message message = defaultMessageBuilder.parseMessage(fullContent); {code} Cheers, Benoit Tellier > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli >Priority: Major > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369935#comment-16369935 ] Raffaele Gambelli commented on MIME4J-265: -- Sorry guys, I wouldn't really want be insistent but I would need to have some updates about this issue. May I ask you if you have a plan to fix it? Could you give me some hints how configure MimeConfig to disable this limit? I would'nt ever change default limits but if I had no choice... Thanks, regards > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli >Priority: Major > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16363811#comment-16363811 ] Raffaele Gambelli commented on MIME4J-265: -- Hi, sorry but I don't understand if you think it is a real issue and so if you think to resolve it, I would have the need to know it and possibly when. Really thanks, bye > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli >Priority: Major > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16316054#comment-16316054 ] Oleg Kalnichevski commented on MIME4J-265: -- bq. What is misleading is that maxHeaderLength is the total length of a header (and not of a line). Hence max _header_ length and not max line length bq. The point IMHO is exactly that one, for what I know there is no overall header limit, the only limit is on the single line The MIME specification intentionally does not impose any specific limits on MIME message elements and leaves it up to implementations to decide what is deemed safe in their specific contexts. Oleg > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315879#comment-16315879 ] Raffaele Gambelli commented on MIME4J-265: -- {quote}What is misleading is that maxHeaderLength is the total length of a header (and not of a line).{quote} The point IMHO is exactly that one, for what I know there is no overall header limit, the only limit is on the single line, read for example [here|http://support.everycloudtech.com/support/solutions/articles/470246-rfc-2822-line-limits-applicable-for-mime-body-line-limits-] > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315628#comment-16315628 ] Tellier Benoit commented on MIME4J-265: --- Hi, Looking at your question : > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: The answer is simple: a header might be on multiple lines, eg {code} Received: from X (X [X.X.X.X]) by X with LMTPA; Thu, 09 Nov 2017 11:14:13 +0100 {code} And DefaultFieldBuilder aggregates several byte buffers into a single raw field, concatenating them. Hence, the line you are pointing is valid. What is misleading is that maxHeaderLength is the total length of a header (and not of a line). Note that you can play with *MimeConfig* in order to change the defaults limits. Cheers, Benoit > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16313101#comment-16313101 ] Raffaele Gambelli commented on MIME4J-265: -- Thanks Tellier, I can add this information, my email has *268 recipients* so the field "To" has 268 lines, for a total of 17186 characters, I think that could be the cause of exception. Another thing, can you add the information about which header is too long in logs? Thanks, bye > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (MIME4J-265) Possible wrong calculation of header length
[ https://issues.apache.org/jira/browse/MIME4J-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16313045#comment-16313045 ] Tellier Benoit commented on MIME4J-265: --- Thanks for the report. I will get a look on this on monday. > Possible wrong calculation of header length > --- > > Key: MIME4J-265 > URL: https://issues.apache.org/jira/browse/MIME4J-265 > Project: James Mime4j > Issue Type: Bug >Affects Versions: 0.7.2 >Reporter: Raffaele Gambelli > Labels: headers > > I've implemented a sort of mail server and I have many threads listening for > incoming emails. > I'm using mime4j to parse javamail Message. > I had only one case of: > Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum > header length limit exceeded > at > org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63) > at > org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212) > at > org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258) > Looking at the code of DefaultFieldBuilder, it seems that the check over line > length is not done on the single line but on the overall header, I'm refering > to this line: > {code:java} > if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) { > {code} > Why should you add "this.buf.length" ? > I know that there is no limit on header length, but only in its lines. > I can't attach my eml for privacy reasons but I can confirm that I have no > too much long line > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)