changeset: 92611:ea665bae2ea0 parent: 92609:ed1dbac90b92 parent: 92610:5e3f8bd33cf2 user: R David Murray date: Sat Sep 27 16:57:51 2014 -0400 files: Lib/distutils/command/upload.py Misc/ACKS Misc/NEWS description: Merge: #10510: make distuitls upload/register use HTML standards compliant CRLF. diff -r ed1dbac90b92 -r ea665bae2ea0 Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py Sat Sep 27 23:22:35 2014 +0300 +++ b/Lib/distutils/command/upload.py Sat Sep 27 16:57:51 2014 -0400 @@ -141,11 +141,11 @@ # Build up the MIME payload for the POST data boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = b'\n--' + boundary.encode('ascii') - end_boundary = sep_boundary + b'--' + sep_boundary = b'\r\n--' + boundary.encode('ascii') + end_boundary = sep_boundary + b'--\r\n' body = io.BytesIO() for key, value in data.items(): - title = '\nContent-Disposition: form-data; name="%s"' % key + title = '\r\nContent-Disposition: form-data; name="%s"' % key # handle multiple entries for the same name if not isinstance(value, list): value = [value] @@ -157,12 +157,12 @@ value = str(value).encode('utf-8') body.write(sep_boundary) body.write(title.encode('utf-8')) - body.write(b"\n\n") + body.write(b"\r\n\r\n") body.write(value) if value and value[-1:] == b'\r': body.write(b'\n') # write an extra newline (lurve Macs) body.write(end_boundary) - body.write(b"\n") + body.write(b"\r\n") body = body.getvalue() msg = "Submitting %s to %s" % (filename, self.repository) diff -r ed1dbac90b92 -r ea665bae2ea0 Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py Sat Sep 27 23:22:35 2014 +0300 +++ b/Lib/distutils/tests/test_upload.py Sat Sep 27 16:57:51 2014 -0400 @@ -127,7 +127,7 @@ # what did we send ? headers = dict(self.last_open.req.headers) - self.assertEqual(headers['Content-length'], '2087') + self.assertEqual(headers['Content-length'], '2163') content_type = headers['Content-type'] self.assertTrue(content_type.startswith('multipart/form-data')) self.assertEqual(self.last_open.req.get_method(), 'POST') diff -r ed1dbac90b92 -r ea665bae2ea0 Misc/ACKS --- a/Misc/ACKS Sat Sep 27 23:22:35 2014 +0300 +++ b/Misc/ACKS Sat Sep 27 16:57:51 2014 -0400 @@ -281,6 +281,7 @@ Garrett Cooper Greg Copeland Aldo Cortesi +Ian Cordasco David Costanzo Scott Cotton Greg Couch diff -r ed1dbac90b92 -r ea665bae2ea0 Misc/NEWS --- a/Misc/NEWS Sat Sep 27 23:22:35 2014 +0300 +++ b/Misc/NEWS Sat Sep 27 16:57:51 2014 -0400 @@ -145,6 +145,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.