james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <nik...@trillian.se>
Subject Re: [mime4j] boundaries and parsing
Date Mon, 14 Jul 2008 20:02:41 GMT
Stefano Bagnara wrote:
> Niklas submitted this message as part of MIME4J-52
> ==========================
> Content-Type: multipart/mixed; boundary="outer-boundary"
>
> Outer preamble
>
> --outer-boundary
> Content-Type: text/plain
>
> Foo
>
> --outer-boundary
> Content-Type: multipart/alternative; boundary="inner-boundary"
>
> AAA
>
> --outer-boundary--
> Outer epilouge
> ============================
>
> What is the expected result for this?
>
> Should the parser understand that the inner multipart never starts and 
> that it instead find another outer boundary?
>
> ATM mime4j locks in a loop.
> Adding the fix I proposed in a comment to that issue the result is 
> that mime4j consider:
> =============================
> AAA
>
> --outer-boundary--
> Outer epilouge
> =============================
> the preamble of the inner multipart ignoring the "--outer-boundary--" 
> of the external multipart.
>
>
> What is the correct/best way to handle bad multiparts like this?
With the old version of Mime4j the result would be:

===============================
AAA

===============================

this would be reported as the inner multipart's preamble while

===============================
Outer epilogue
===============================

would reported as the outer multipart's epilogue.

Furthermore, IIRC, the old Mime4j would report an empty bodypart and 
empty epilogue for the inner multipart. I think this is a nice feature 
since the events generated by Mime4j would always represent a valid MIME 
message even if the input isn't entirely valid.


-- 
Niklas Therning
www.spamdrain.net

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message