R. David Murray added the comment:
It is a bug, but it is not a bug that the message-id body gets put on a second
line. The old (compat32) folder introduces an extra space while folding, which
then gets preserved when the re-parsing is done. The new folder
(policy=default) folds correctly (putting the id on a separate line), but the
parser fails to remove the leading blank from the value when it is parsed. It
should remove the leading blank because that blank "belongs" to the header
label (the "Message-Id:" part). The RFC caution about whitespace only lines
applies to whole lines; the first line in the present example is not blank
because it has the header label on it.
I also need to add a test with a Message-Id that is in itself longer than 77
characters. Such a header can't be folded, so it will have to be emitted with
a length longer than the default. (And yes, the default can be changed to any
value you like, see Policy.max_line_len).
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list