summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 71011bd..9a0ab60 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1605,9 +1605,9 @@ class URLopener:
size = -1
read = 0
blocknum = 0
+ if "content-length" in headers:
+ size = int(headers["Content-Length"])
if reporthook:
- if "content-length" in headers:
- size = int(headers["Content-Length"])
reporthook(blocknum, bs, size)
while 1:
block = fp.read(bs)