
Nathan Herring wrote:
I've increased the subject length of this mail, and removed the "[Mailman-developers]" attribution, so we can see firsthand whether or not this list, which purports to be running 2.1.6, and I presume is running a suitable version of Python, has the same issue.
and Mark Sapiro previously wrote:
Brad is correct here. Mailman represents messages as instances of the Python email.Message.Message class and is at the mercy of the methods in that class as far header folding and unfolding are concerned. And, for the record, even the Python 2.4.2 email module folds with a <tab>.
Clearly what I said above is not the whole story as Nathan's message that I received from the list had the Subject: folded with a <space>, yet other Mailman related headers in the message, namely List-Unsubscribe: and List-Subscribe: are folded with <tab>.
Upon closer examination, I see that the email.Header.Header class supports a continuation_ws argument which as Brad notes is used in CookHeaders. The prefix_subject function in CookHeaders attempts to determine the continuation-ws character from the existing header by looking at the first character of the first continuation line of the original subject header. If the header isn't continued or if the first character of the first continuation is not a <space> or <tab>, it defaults to a <tab>.
Thus it will try to preserve the continuation-ws of an already folded incoming subject, but will default to <tab>. Thus if the incoming subject is not folded, but addition of the prefix lengthens it sufficiently so it folds, it will be continued with a <tab>.
BTW, this code has been in CookHeaders since 2.1.1, so I don't think anything will change in this respect between 2.1.2 and 2.1.6.
It does seem however, that given RFC 2822, the default continuation-ws character in CookHeaders should be <space> and not <tab>.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan