summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-09-27 20:56:15 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-09-27 20:56:15 (GMT)
commit9ce69672f3a1fbd9f337737bf35ace1a1a592598 (patch)
treee2fc43e283dd7493bf51ea59c1767406f49ffaea /Lib/distutils/command
parent3749404ba5968c5571d47bc8a984f008a7eb8f80 (diff)
downloadcpython-9ce69672f3a1fbd9f337737bf35ace1a1a592598.zip
cpython-9ce69672f3a1fbd9f337737bf35ace1a1a592598.tar.gz
cpython-9ce69672f3a1fbd9f337737bf35ace1a1a592598.tar.bz2
#10510: make distuitls upload/register use HTML standards compliant CRLF.
Patch by Ian Cordasco, approved by Éric Araujo.
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r--Lib/distutils/command/upload.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 180be7c..9b15b67 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -143,11 +143,11 @@ class upload(PyPIRCCommand):
# 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 type(value) != type([]):
value = [value]
@@ -159,12 +159,12 @@ class upload(PyPIRCCommand):
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()
self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO)