[
https://issues.apache.org/jira/browse/MIME4J-60?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616447#action_12616447
]
Stefano Bagnara commented on MIME4J-60:
---------------------------------------
This is from an only 3 days old message in the mailing list but after dozen of
messages it seems to be forgot now so I fear this could be lost, and this is an
important thing wrt this issue:
------------------------------------------------
I'm not sure how can we deal with CR-LF in a consistent way if we don't do this
at a low level, but maybe I'm missing something.
What do you propose should every component in mime4j have the ability to deal
with malformed line endings? Should we make each of them configurable?
ATM I could this places where we deal with newlines:
1) RootInputStream: count lines only when CRLF is found.
2) BufferedLinedReaderInputStream: readLine return byte sequences ending with LF
3) AbstractEntity: during header parsing ending LF or ending CRLF is stripped
out from lines.
4) QuotedPrintableInputStream deals with isolated \r and \n (not sure HOW it
consider them) and log warning each time they are found isolated.
5) MimeUtil.getHeaderParams consider isolated CR and isolated LF as newlines
(ignoring them) (so that CR is alone is not returned in an header value)
6) MimeBoundaryInputStream.calculateBoundaryLen seems to strip ending \n always
and \r only if it is before a \n or it is the boundary length is one more char
(BUG? it doesn't recalculate let after the first if)
I don't know if in the javacc/jjtree code we have more CR/LF logic.
-----------------------------
I add that I don't know the classification (pull parser, DOM, SAX) of the 6
classes above (I hope Robert can help with this), but I think that at most we
should have 1 place for each layer dealing with newlines strategies and not 6.
> Configurable strategy for line delimiters
> -----------------------------------------
>
> Key: MIME4J-60
> URL: https://issues.apache.org/jira/browse/MIME4J-60
> Project: Mime4j
> Issue Type: Wish
> Affects Versions: 0.4
> Reporter: Stefano Bagnara
> Fix For: 0.5
>
> Attachments: MIME4J-60-readLine-returns-no-newline.patch,
> newlines-tests.zip, newlinestrat.patch
>
>
> There is an ongoing discussion about how we should deal with non canonical
> line endings (isolated LF and/or isolated CR).
> This issue is to track discussion results and proposed patches.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]