[Mailman-Developers] Two bugs in email 0.96 that you may want to fix sooner rather than later
Dan Mick
Dan Mick <dmick@utopia.West.Sun.COM>
Wed, 5 Dec 2001 19:20:40 -0800 (PST)
I've reported these to Barry, and so real fixes are on the way
eventually; however, they're both annoying enough that I thought
I might drop them here too. AFAIK, these bugs are still present
in email 1.0 as well.
1) MIME messages with spaces around = sign in parameters of Content-Type
aren't handled
I think this is a non-compliant message, but I get a bunch of bounces
(mostly from Hotmail..big shock that *they'd* be noncompliant, huh?)
that have Content-Type headers of the form:
Content-Type: Multipart/mixed;
boundary = "CPIMSSMTPC06p5f3tG"
The spaces around the = are the problem. This fixes them, I
think without doing any other harm.
(Message.py in the email package):
--- Message.py Mon Dec 3 18:13:50 2001
***************
*** 304,309 ****
--- 304,311 ----
for p in paramre.split(value):
try:
name, val = p.split('=', 1)
+ name = name.strip()
+ val = val.strip()
except ValueError:
# Must have been a bare attribute
name = p
Without this, qfiles/shunt fills up full of these messages.
2) MIME messages with long header lines have those headers corrupted
on regeneration of messages.
I'm pretty sure Bob Puff noticed this, but I can't find the thread anymore.
Anyway, you end up with Content-Type (typically) that's been weirdly
formatted into things like
Content-Type: multipart/report;;
Content-Type: multipart/report;;boundary=foo
instead of the proper
Content-Type: multipart/report;
boundary=foo
because of some full-part/subpart variable name confusion in
email's Generator.py:
Printing long header lines that require split_header() in Generator.py
can go wrong because of confusion between the original line and
the sub-lines. Here's a unified diff. For the most part, it's
replacing 'text' with 'line' in the right places.
--- /export/home/dmick/pymod/Generator.py Mon Dec 3 17:59:58 2001
+++ Generator.py Mon Dec 3 18:57:02 2001
@@ -175,22 +175,22 @@
rtn.append(line)
SEMINLTAB.join(rtn)
else:
- oldlen = len(text)
+ oldlen = len(line)
# Try to break the line on semicolons, but if that doesn't
# work, try to split on folding whitespace.
- while len(text) > maxheaderlen:
- i = text.rfind(';', 0, maxheaderlen)
+ while len(line) > maxheaderlen:
+ i = line.rfind(';', 0, maxheaderlen)
if i < 0:
break
- rtn.append(text[:i])
- text = text[i+1:].lstrip()
- if len(text) <> oldlen:
+ rtn.append(line[:i])
+ line = line[i+1:].lstrip()
+ if len(line) <> oldlen:
# Splitting on semis worked
- rtn.append(text)
+ rtn.append(line)
return SEMINLTAB.join(rtn)
# Splitting on semis didn't help, so try to split on
# whitespace.
- parts = re.split(r'(\s+)', text)
+ parts = re.split(r'(\s+)', line)
# Watch out though for "Header: longnonsplittableline"
if parts[0].endswith(':') and len(parts) == 3:
return text