diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-09-27 20:59:04 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-09-27 20:59:04 (GMT) |
commit | 9ad23c6c315d09bef659a12a9f7f7123c707ea41 (patch) | |
tree | 930090c6b2750ecc22a1b6f555d29b9eaeca48d6 | |
parent | 1b4b7af1d1353ac2eaaa65bee69a750b5d249e95 (diff) | |
download | cpython-9ad23c6c315d09bef659a12a9f7f7123c707ea41.zip cpython-9ad23c6c315d09bef659a12a9f7f7123c707ea41.tar.gz cpython-9ad23c6c315d09bef659a12a9f7f7123c707ea41.tar.bz2 |
#10510: make distuitls upload/register use HTML standards compliant CRLF.
Patch by Ian Cordasco, approved by Éric Araujo.
-rw-r--r-- | Lib/distutils/command/upload.py | 9 | ||||
-rw-r--r-- | Lib/distutils/tests/test_upload.py | 2 | ||||
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
4 files changed, 9 insertions, 6 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py index 9aa54ee..b773f47 100644 --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -136,8 +136,8 @@ class upload(PyPIRCCommand): # Build up the MIME payload for the POST data boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = '\n--' + boundary - end_boundary = sep_boundary + '--' + sep_boundary = '\r\n--' + boundary + end_boundary = sep_boundary + '--\r\n' body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name @@ -151,14 +151,13 @@ class upload(PyPIRCCommand): fn = "" body.write(sep_boundary) - body.write('\nContent-Disposition: form-data; name="%s"'%key) + body.write('\r\nContent-Disposition: form-data; name="%s"' % key) body.write(fn) - body.write("\n\n") + body.write("\r\n\r\n") body.write(value) if value and value[-1] == '\r': body.write('\n') # write an extra newline (lurve Macs) body.write(end_boundary) - body.write("\n") body = body.getvalue() self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py index 17735d3..9290f9c 100644 --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -119,7 +119,7 @@ class uploadTestCase(PyPIRCCommandTestCase): # what did we send ? self.assertIn('dédé', self.last_open.req.data) headers = dict(self.last_open.req.headers) - self.assertEqual(headers['Content-length'], '2085') + self.assertEqual(headers['Content-length'], '2159') self.assertTrue(headers['Content-type'].startswith('multipart/form-data')) self.assertEqual(self.last_open.req.get_method(), 'POST') self.assertEqual(self.last_open.req.get_full_url(), @@ -274,6 +274,7 @@ David M. Cooke Jason R. Coombs Garrett Cooper Greg Copeland +Ian Cordasco Aldo Cortesi David Costanzo Scott Cotton @@ -22,6 +22,9 @@ Core and Builtins Library ------- +- Issue #10510: distutils register and upload methods now use HTML standards + compliant CRLF line endings. + - Issue #9850: Fixed macpath.join() for empty first component. Patch by Oleg Oshmyan. |