Commits

Tarek Ziadé committed 02a0c50

Tolerate responses with multiple Content-Length headers - fixes #196

  • Participants
  • Parent commits 4147521

Comments (0)

Files changed (1)

setuptools/package_index.py

             bs = self.dl_blocksize
             size = -1
             if "content-length" in headers:
-                size = int(headers["Content-Length"])
+                # Some servers return multiple Content-Length headers :(
+                content_length = headers.getheaders("Content-Length")[0]
+                size = int(content_length)
                 self.reporthook(url, filename, blocknum, bs, size)
             tfp = open(filename,'wb')
             while True: