summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-11-10 21:43:44 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-11-10 21:43:44 (GMT)
commit6b0bdab4293684a2a7e47e8e8e70076c8670eb9b (patch)
tree6ec957a8c657b0e66d3fed6d6c944068137afc59 /Lib/urllib
parent296c2fd065f3ad026dd7169d5fd323a0fee40b31 (diff)
downloadcpython-6b0bdab4293684a2a7e47e8e8e70076c8670eb9b.zip
cpython-6b0bdab4293684a2a7e47e8e8e70076c8670eb9b.tar.gz
cpython-6b0bdab4293684a2a7e47e8e8e70076c8670eb9b.tar.bz2
Fixes issue #16409: The reporthook callback made by the legacy
urllib.request.urlretrieve API now properly supplies a constant non-zero block_size as it did in Python 3.2 and 2.7. This matches the behavior of urllib.request.URLopener.retrieve.
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 27ab2b9..5ddec5f 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -208,7 +208,7 @@ def urlretrieve(url, filename=None, reporthook=None, data=None):
size = int(headers["Content-Length"])
if reporthook:
- reporthook(blocknum, 0, size)
+ reporthook(blocknum, bs, size)
while True:
block = fp.read(bs)
@@ -218,7 +218,7 @@ def urlretrieve(url, filename=None, reporthook=None, data=None):
tfp.write(block)
blocknum += 1
if reporthook:
- reporthook(blocknum, len(block), size)
+ reporthook(blocknum, bs, size)
if size >= 0 and read < size:
raise ContentTooShortError(