Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sivel/speedtest-cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxu <i@liuxu.me>2018-12-01 18:58:38 +0300
committerMatt Martz <matt@sivel.net>2018-12-03 19:26:09 +0300
commita8a32650015997f7847f2de72a29ff7906f53d8a (patch)
tree36dfae35ddf9f63dc5e936fd8bfda83de23f3265
parentb2654de4107b236eb5417c1ebeeebbf82a391d71 (diff)
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
-rwxr-xr-xspeedtest.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/speedtest.py b/speedtest.py
index 276cf3f..14d2dd6 100755
--- a/speedtest.py
+++ b/speedtest.py
@@ -1522,9 +1522,11 @@ class Speedtest(object):
)
if pre_allocate:
data.pre_allocate()
+
+ headers = {'Content-length': size}
requests.append(
(
- build_request(self.best['url'], data, secure=self._secure),
+ build_request(self.best['url'], data, secure=self._secure, headers=headers),
size
)
)