diff options
author | Guido van Rossum <guido@python.org> | 1997-08-26 19:06:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-26 19:06:40 (GMT) |
commit | ab0abdcef8dac933d838cb584dd4b728c2474b1e (patch) | |
tree | 4514f15ac2574473fdf6807aa5a3b0325fe7bc4b /Lib/urllib.py | |
parent | 36b8f945e794e8483a185db3b6847c083a724e44 (diff) | |
download | cpython-ab0abdcef8dac933d838cb584dd4b728c2474b1e.zip cpython-ab0abdcef8dac933d838cb584dd4b728c2474b1e.tar.gz cpython-ab0abdcef8dac933d838cb584dd4b728c2474b1e.tar.bz2 |
Explicitly close the socket and temp file in URLopener.retrieve(), so
that multiple retrievals using the same connection will work.
This leaves open the more general problem that after
f = urlopen("ftp://...")
f must be closed before another retrieval from the same host should be
attempted.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 337015f..82a26b3 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -191,6 +191,8 @@ class URLopener: while block: tfp.write(block) block = fp.read(bs) + fp.close() + tfp.close() del fp del tfp return result |