R. David Murray <rdmur...@bitdance.com> added the comment:

The only way I can think of to fix this that won't fail in the case
where the body ends with just '\r' (rather than '\r\n' the way the test
body does) is to have feedparser keep track of what the overall line
endings for the stream being parsed are.  ie: to basicly outlaw
mixed-line-ending input (except insofar as such alternate line endings
are encoded in a non-text multipart).  That seems like something that
should only be considered in the context of email 6.0 rather than in a
bug fix.

cgi doesn't use a RE, by the way, it just looks at the last two
chars...and is subject to the same bug if a part ends with '\r' in input
with '\n' line terminators.

I've attached a patch that turns Guido's test into a test case, and
fixes his edge case.  I did not touch the other places where the eol RE
is used, since in those cases there should not be binary data preceeding
the line ending characters.

----------
keywords: +patch
priority:  -> normal
stage:  -> patch review
Added file: http://bugs.python.org/file14729/issue6681.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6681>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to