Python 2.4a1/Anon CVS of 5 Aug 2004. WinXP SP1, not that that matters. This is a patch to fix bug: [ 1002475 ] email message parser doesn't handle \r\n correctly http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=1002475 Basically, FeedParser does a rstrip() on the last header value, but not any of the others. Given that RFC822 wants the headers to end with \r\n, it's likely that most will, and this means that all the headers except for the last end with \r. This one line patch just does the extra rstrip. Note that you might want to implement the fix yourself - it doesn't fit on a line, and so it's wrapped in an ugly way - maybe you can think of something prettier :) This does fix the problem, though (here, at least, using the test case outlined in the bug report).
Logged In: YES user_id=552329 Attaching new patch, because that one breaks one of the tests. The rstrip() needs to be rstrip('\r\n') or it strips other whitespace that isn't allowed there.
Logged In: YES user_id=552329 Also attached is a patch for test_email.py. This adds two new tests (which fail before the FeedParser.py patch, and pass afterwards). The first tests that the \r\n characters are correctly removed. The second is a copy of an existing test to check continuations with whitespace, but checks if it works with the continuation as the last header.