Fix python3 upload problem

In python3, if Content-length is not set,urllib.request.AbstractHTTPHandler::do_request_() will use "Transfer-encoding:chunked", which will cause HTTPUploader not to exit until timeout
This commit is contained in:
liuxu 2018-12-01 23:58:38 +08:00 committed by Matt Martz
parent b2654de410
commit a8a3265001
1 changed files with 3 additions and 1 deletions

View File

@ -1522,9 +1522,11 @@ class Speedtest(object):
) )
if pre_allocate: if pre_allocate:
data.pre_allocate() data.pre_allocate()
headers = {'Content-length': size}
requests.append( requests.append(
( (
build_request(self.best['url'], data, secure=self._secure), build_request(self.best['url'], data, secure=self._secure, headers=headers),
size size
) )
) )