This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: weird header wrapping in email.Generator
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, gward, skip.montanaro
Priority: normal Keywords:

Created on 2002-08-28 16:14 by gward, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
funky-recd gward, 2002-08-28 16:16 message consisting of the hard-to-wrap header line
hwrap gward, 2002-08-28 16:17 test script to illustrate the dubious header wrapping
hwrap.py barry, 2002-08-28 16:28
Messages (4)
msg12185 - (view) Author: Greg Ward (gward) (Python committer) Date: 2002-08-28 16:14
I have discovered a particular header line that 
email.Generator does not wrap very well.  Here it is, 
mangled by my web browser and SF:

Received: from 
modemcable093.139-201-24.que.mc.videotron.ca 
([24.201.139.93] helo=cthulhu.gerg.ca)
        by kronos.mems-exchange.org with esmtp (Exim 
4.05)
        id 17k4h5-00034i-00
        for test@mems-exchange.org; Wed, 28 Aug 2002 
11:25:20 -0400

(Only one line, the first, is particularly long.  The other 
three lines all fit comfortably in 78 columns.)

(Oh, I'll try to attach a message consisting solely of this 
header line along with my test script.)

With Python 2.2.1, email.Message.as_string() wraps this 
header line as:

Received: from 
modemcable093.139-201-24.que.mc.videotron.ca 
([24.201.139.93]
        helo=cthulhu.gerg.ca)
        by kronos.mems-exchange.org with esmtp (Exim 
4.05)
        id
        17k4h5-00034i-00
        for test@mems-exchange.org; Wed, 28 Aug 2002 
11:25:20 -0400

(The oddity there is the word "id" alone on a line.)

With CVS Python (as of 10 minutes ago), it's wrapped as:

Received: from 
modemcable093.139-201-24.que.mc.videotron.ca 
([24.201.139.93]
        helo=cthulhu.gerg.ca)
        by kronos.mems-exchange.org with esmtp (Exim 
4.05)id 17k4h5-00034i-00
        for test@mems-exchange.org; Wed, 28 Aug 2002 
11:25:20 -0400

(Note how "id ..." is jammed right up against "(Exim 
4.05)".)

msg12186 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-08-28 16:28
Logged In: YES 
user_id=12800

Verified.  Here's a one-file example that illustrates the bug.
msg12187 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-08-29 16:26
Logged In: YES 
user_id=44345

I believe this is a duplicate of the bug report I filed:

    http://python.org/sf/594893

One or the other should probably be closed.
msg12188 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-09-10 15:56
Logged In: YES 
user_id=12800

It looks like a really simple patch to Header.py fixes this,
and causes no regressions in the test suite.  That's good
enough for me, but I have some vague worries that it could
cause breakage.  This will be committed to Header.py 1.11
History
Date User Action Args
2022-04-10 16:05:37adminsetgithub: 37100
2002-08-28 16:14:30gwardcreate