Commit 69e48ac6 authored by Mark Sapiro's avatar Mark Sapiro

Merge branch 'fix_725' into 'master'

MS Outlook is only violating a SHOULD so don't claim non-compliance.

See merge request !653
parents 056eb0e7 76b1f6dd
Pipeline #150647032 passed with stage
in 9 minutes and 20 seconds
......@@ -19,7 +19,7 @@ Bugs
and footers. (Closes #701)
* RFC 2369 headers are now added to notification messages. (Closes #710)
* Bounce probes are now encoded in the correct charset. (Closes #712)
* We now appropriately parse an incorrectly folded Cc: header from MS Outlook.
* We now unfold address containing headers before parsing in avoid_duplicates.
(Closes #725)
......
......@@ -57,12 +57,13 @@ class AvoidDuplicates:
explicit_recips = listaddrs.copy()
# Figure out the set of explicit recipients.
cc_addresses = {}
# MS Outlook creates a defective message when composing with several
# Cc addresses of the form `real name (dept) <[email protected]>`,
# Outlook quotes "real name (dept)" and then folds the header between
# `name and (dept)` resulting in a header including the entry
# '"real name\r\n (dept)" <[email protected]>' which is non-compliant
# and parses incorrectly, so we "unfold" headers here.
# We've seen messages with Cc: headers folded inside a quoted string.
# I.e., a message composed with several Cc addresses of the form
# 'real name (dept) <[email protected]>', the MUA quotes
# "real name (dept)" and then folds the header between 'name' and
# '(dept)' resulting in a header including the entry
# '"real name\r\n (dept)" <[email protected]>' which parses incorrectly,
# so we "unfold" headers here.
for header in ('to', 'cc', 'resent-to', 'resent-cc'):
hdrs_unfolded = [re.sub('[\r\n]', '', value) for value in
msg.get_all(header, [])]
......
......@@ -77,13 +77,14 @@ X-Mailman-Version: X.Y
More things to say.
""")
def test_bogus_ms_outlook_header_folding(self):
# MS Outlook creates a defective message when composing with several
# Cc addresses of the form `real name (dept) <[email protected]>`,
# Outlook quotes "real name (dept)" and then folds the header between
# `name and (dept)` resulting in a header including the entry
# '"real name\r\n (dept)" <[email protected]>' which is non-compliant
# and parses incorrectly. Test our unfolding defense.
def test_bogus_header_folding(self):
# We've seen messages with Cc: headers folded inside a quoted string.
# I.e., a message composed with several Cc addresses of the form
# 'real name (dept) <[email protected]>', the MUA quotes
# "real name (dept)" and then folds the header between 'name' and
# '(dept)' resulting in a header including the entry
# '"real name\r\n (dept)" <[email protected]>' which parses incorrectly,
# This tests that we unfold properly.
msg = mfs("""\
From: [email protected]
To: [email protected]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment