From bd836dfba3fd0d86807196c4049e998a4b9b9b92 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 6 Mar 2003 20:33:04 +0000 Subject: _split_ascii(): In the clause where curlen + partlen > maxlen, if the part itself is longer than maxlen, and we aren't already splitting on whitespace, then we recursively split the part on whitespace and append that to the this list. --- Lib/email/Header.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/email/Header.py b/Lib/email/Header.py index 47a5508..83fe0d5 100644 --- a/Lib/email/Header.py +++ b/Lib/email/Header.py @@ -456,7 +456,14 @@ def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): elif curlen + partlen > maxlen: if this: lines.append(joiner.join(this) + eol) - this = [part] + # If this part is longer than maxlen and we aren't already + # splitting on whitespace, try to recursively split this line + # on whitespace. + if partlen > maxlen and ch <> ' ': + this = [_split_ascii(part, maxlen, restlen, + continuation_ws, ' ')] + else: + this = [part] linelen = wslen + partlen maxlen = restlen else: -- cgit v0.12