]> granicus.if.org Git - python/commitdiff
Merge: #10510: make distuitls upload/register use HTML standards compliant CRLF.
authorR David Murray <rdmurray@bitdance.com>
Sat, 27 Sep 2014 20:57:51 +0000 (16:57 -0400)
committerR David Murray <rdmurray@bitdance.com>
Sat, 27 Sep 2014 20:57:51 +0000 (16:57 -0400)
1  2 
Lib/distutils/command/upload.py
Misc/ACKS
Misc/NEWS

index 1fdb456a6d1fc0e4ac84950e7043611c1203fff9,9b15b67bae183f7244007542485532a030dcaedc..e3f6f69607d319a55d7dc72929dec7cc5f97754e
@@@ -141,13 -143,13 +141,13 @@@ 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([]):
 +            if not isinstance(value, list):
                  value = [value]
              for value in value:
                  if type(value) is tuple:
                  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)
 +        msg = "Submitting %s to %s" % (filename, self.repository)
 +        self.announce(msg, log.INFO)
  
          # build the Request
 -        headers = {'Content-type':
 -                        'multipart/form-data; boundary=%s' % boundary,
 -                   'Content-length': str(len(body)),
 -                   'Authorization': auth}
 +        headers = {
 +            'Content-type': 'multipart/form-data; boundary=%s' % boundary,
 +            'Content-length': str(len(body)),
 +            'Authorization': auth,
 +        }
  
          request = Request(self.repository, data=body,
                            headers=headers)
diff --cc Misc/ACKS
Simple merge
diff --cc Misc/NEWS
Simple merge