[Mailman-Users] A scrubber issue

Tokio Kikuchi tkikuchi at is.kochi-u.ac.jp
Sat Dec 9 07:31:34 CET 2006


Hi all,

Mark Sapiro wrote:
> Todd Zullinger wrote:
>> Attached is the original message from the list mbox and one that I
>> munged up to included a content-type: text/plain; charset=3Dus-ascii.
> 
> 
> I see the symptom with the original message. I'll look further, but it
> seems to have something to do with the fact that the first sub-part
> has no headers at all. I have looked at RFC 2045 and I don't see that
> any headers are required, but I don't yet know what the underlying
> issue in Scrubber is.
> 
It looks like the problem is something to do with email package 
behavior.  Here is a test code to reproduce the problem:

----------------
from email import message_from_string

s = '''MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="ABCDEFG"

Preamble

--ABCDEFG

A message without header

--ABCDEFG
Content-Disposition: inline

Another text with a header

--ABCDEFG--
'''

m = message_from_string(s)
for p in m.walk():
     print p.get_content_type()
     if p:
         print p.get_payload(decode=True)

----------------

This program prints out like this:

multipart/mixed
None
text/plain
text/plain
Another text with a header

Note that 'A message without header' is not printed out.

If I remove 'If p:' and print the payload unconditionally, I get:

multipart/mixed
None
text/plain
A message without header

text/plain
Another text with a header

Here, the no-header part is printed out.

The patch of revision 7281 may have been over-protective against the 
bug-id: 1099138 in message reconstruction part (line 327 in 
http://mailman.svn.sourceforge.net/viewvc/mailman/branches/Release_2_1-maint/mailman/Mailman/Handlers/Scrubber.py?r1=7207&r2=7281 
) but we may have to be paranoid against wired message like no-header 
text.  I believe well behaved MUAs won't generate no-header text parts. 
  (or, I believed ;-)

-- 
Tokio Kikuchi, tkikuchi at is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/


More information about the Mailman-Users mailing list