This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum
Date 2009-08-10.22:58:31
SpamBayes Score 4.152337e-08
Marked as misclassified No
Message-id <1249945114.19.0.529736934099.issue6681@psf.upfronthosting.co.za>
In-reply-to
Content
I am using an edge case of multipart/mixed and find that the
multipart/mix parser in the email package is broken.  See attached
example.  Similar code using cgi.FieldStorage (!) works fine.

The problem happens through the following combination of factors:

1. Content-Length given
2. Content-Transfer-Encoding: 8bit
3. Last two bytes of the part body are '\r\n'

In this case, the final '\n' is removed from the part body, leaving it a
byte short.  Note that interior occurrences of '\r\n' work fine, as does
any other binary data -- it's only a trailing '\r\n' that breaks.

Note that technically perhaps the use of 8bit is invalid; but the same
problem happens when using binary instead.

The problem can be reproduced in Python 3.x using nearly the same demo
by change the cStringIO import to "import io".
History
Date User Action Args
2009-08-10 22:58:34gvanrossumsetrecipients: + gvanrossum
2009-08-10 22:58:34gvanrossumsetmessageid: <1249945114.19.0.529736934099.issue6681@psf.upfronthosting.co.za>
2009-08-10 22:58:32gvanrossumlinkissue6681 messages
2009-08-10 22:58:32gvanrossumcreate