changeset: 92612:9ad78b4b169c branch: 2.7 parent: 92607:6946036f21ef user: R David Murray date: Sat Sep 27 16:59:04 2014 -0400 files: Lib/distutils/command/upload.py Lib/distutils/tests/test_upload.py Misc/ACKS Misc/NEWS description: #10510: make distuitls upload/register use HTML standards compliant CRLF. Patch by Ian Cordasco, approved by Éric Araujo. diff -r 6946036f21ef -r 9ad78b4b169c Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py Sat Sep 27 22:55:10 2014 +0300 +++ b/Lib/distutils/command/upload.py Sat Sep 27 16:59:04 2014 -0400 @@ -136,8 +136,8 @@ # 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 @@ 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 -r 6946036f21ef -r 9ad78b4b169c Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py Sat Sep 27 22:55:10 2014 +0300 +++ b/Lib/distutils/tests/test_upload.py Sat Sep 27 16:59:04 2014 -0400 @@ -119,7 +119,7 @@ # 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(), diff -r 6946036f21ef -r 9ad78b4b169c Misc/ACKS --- a/Misc/ACKS Sat Sep 27 22:55:10 2014 +0300 +++ b/Misc/ACKS Sat Sep 27 16:59:04 2014 -0400 @@ -274,6 +274,7 @@ Jason R. Coombs Garrett Cooper Greg Copeland +Ian Cordasco Aldo Cortesi David Costanzo Scott Cotton diff -r 6946036f21ef -r 9ad78b4b169c Misc/NEWS --- a/Misc/NEWS Sat Sep 27 22:55:10 2014 +0300 +++ b/Misc/NEWS Sat Sep 27 16:59:04 2014 -0400 @@ -22,6 +22,9 @@ 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.