]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
parse(), _parseheaders(), _parsebody(): A fix for SF bug #633527,
authorBarry Warsaw <barry@python.org>
Tue, 5 Nov 2002 21:44:06 +0000 (21:44 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 5 Nov 2002 21:44:06 +0000 (21:44 +0000)
commitda2525ed2a9c8ee6219b469fbbae47b9cec2c4ba
treea2ba689a5ee2ea86cac8a113adc58e986243d76e
parenta0a00761a500478223f0e076983fddcdfb4ac587
parse(), _parseheaders(), _parsebody(): A fix for SF bug #633527,
where in lax parsing, the first non-header line after a header block
(e.g. the first line not containing a colon, and not a continuation),
can be treated as the first body line, even without the RFC mandated
blank line separator.

rfc822 had this behavior, and I vaguely remember problems with this,
but can't remember details.  In any event, all the tests still pass,
so I guess we'll find out. ;/

This patch works by returning the non-header, non-continuation line
from _parseheader() and using that as the first header line prepended
to fp.read() if given.  It's usually None.

We use this approach instead of trying to seek/tell the file-like
object.
Lib/email/Parser.py