james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Bagnara (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] Created: (MIME4J-176) Wrong CRLF usage in multipart.writeTo
Date Sat, 27 Mar 2010 10:50:27 GMT
Wrong CRLF usage in multipart.writeTo
-------------------------------------

                 Key: MIME4J-176
                 URL: https://issues.apache.org/jira/browse/MIME4J-176
             Project: JAMES Mime4j
          Issue Type: Bug
          Components: dom
    Affects Versions: 0.6
            Reporter: Stefano Bagnara
            Assignee: Stefano Bagnara
             Fix For: 0.7


MessageWriter currently has this code:
        writeBytes(preamble, out);
        out.write(CRLF);
and 
        out.write(CRLF);
        writeBytes(epilogue, out);

This is correct only when epilogue and preamble exists in the original message, otherwise
it introduces a one empty line epilogue/preamble that was not present in the original message.

RFC clearly states that the CRLF after the preamble can be added only when a preamble exists
(the same for the CRLF before the epilogue) 

     multipart-body := [preamble CRLF]
                       dash-boundary transport-padding CRLF
                       body-part *encapsulation
                       close-delimiter transport-padding
                       [CRLF epilogue]

So, roundtripping doesn't currently work for messages with no preamble or no epilogue, introducing
a new empty line in the output stream.

As an example this make it impossible to DKIM sign and validate messages with empty epilogue/prologue
and it breaks DKIM signatures for such messages (this is true with the "simple" canonicalization
method).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message