summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-02-08 22:56:17 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-02-08 22:56:17 (GMT)
commit66c3d18af1d20b780e7eabbbfb95049c48e3ce48 (patch)
tree2612a66c627ac3c49e46a9d81d0684039de46038
parent127242654de9837f4ee544fc3b0a5b22030613e0 (diff)
parente9c31470e1680b7c9b9ee83c378b891e90ac58ab (diff)
downloadcpython-66c3d18af1d20b780e7eabbbfb95049c48e3ce48.zip
cpython-66c3d18af1d20b780e7eabbbfb95049c48e3ce48.tar.gz
cpython-66c3d18af1d20b780e7eabbbfb95049c48e3ce48.tar.bz2
Merge: #14983: always add a line end after a MIME boundary marker.
-rw-r--r--Lib/email/generator.py3
-rw-r--r--Lib/test/test_email/data/msg_02.txt1
-rw-r--r--Lib/test/test_email/test_email.py15
-rw-r--r--Misc/NEWS4
4 files changed, 16 insertions, 7 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index 07a97c7..e4a86d4 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -299,9 +299,8 @@ class Generator:
# body-part
self._fp.write(body_part)
# close-delimiter transport-padding
- self.write(self._NL + '--' + boundary + '--')
+ self.write(self._NL + '--' + boundary + '--' + self._NL)
if msg.epilogue is not None:
- self.write(self._NL)
if self._mangle_from_:
epilogue = fcre.sub('>From ', msg.epilogue)
else:
diff --git a/Lib/test/test_email/data/msg_02.txt b/Lib/test/test_email/data/msg_02.txt
index 43f2480..5d0a7e1 100644
--- a/Lib/test/test_email/data/msg_02.txt
+++ b/Lib/test/test_email/data/msg_02.txt
@@ -119,6 +119,7 @@ hello
--__--__----
+
--192.168.1.2.889.32614.987812255.500.21814
Content-type: text/plain; charset=us-ascii
Content-description: Digest Footer
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index d1e234d..26ed96c 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -1745,7 +1745,8 @@ From: bperson@dom.ain
--BOUNDARY
---BOUNDARY--''')
+--BOUNDARY--
+''')
def test_no_parts_in_a_multipart_with_empty_epilogue(self):
outer = MIMEBase('multipart', 'mixed')
@@ -1790,7 +1791,8 @@ MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
hello world
---BOUNDARY--''')
+--BOUNDARY--
+''')
def test_seq_parts_in_a_multipart_with_empty_preamble(self):
eq = self.ndiffAssertEqual
@@ -1816,7 +1818,8 @@ MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
hello world
---BOUNDARY--''')
+--BOUNDARY--
+''')
def test_seq_parts_in_a_multipart_with_none_preamble(self):
@@ -1842,7 +1845,8 @@ MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
hello world
---BOUNDARY--''')
+--BOUNDARY--
+''')
def test_seq_parts_in_a_multipart_with_none_epilogue(self):
@@ -1868,7 +1872,8 @@ MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
hello world
---BOUNDARY--''')
+--BOUNDARY--
+''')
def test_seq_parts_in_a_multipart_with_empty_epilogue(self):
diff --git a/Misc/NEWS b/Misc/NEWS
index 19a5292..4d8e4c9 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,10 @@ Core and Builtins
Library
-------
+- Issue #14983: email.generator now always adds a line end after each MIME
+ boundary marker, instead of doing so only when there is an epilogue. This
+ fixes an RFC compliance bug and solves an issue with signed MIME parts.
+
- Issue #20540: Fix a performance regression (vs. Python 3.2) when layering
a multiprocessing Connection over a TCP socket. For small payloads, Nagle's
algorithm would introduce idle delays before the entire transmission of a