From: Barry Warsaw Date: Thu, 6 Mar 2003 20:33:04 +0000 (+0000) Subject: _split_ascii(): In the clause where curlen + partlen > maxlen, if the X-Git-Tag: v2.3c1~1554 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd836dfba3fd0d86807196c4049e998a4b9b9b92;p=thirdparty%2FPython%2Fcpython.git _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. --- diff --git a/Lib/email/Header.py b/Lib/email/Header.py index 47a5508ff275..83fe0d5dbdb7 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: