Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c4dcea

Browse files
author
Charles-François Natali
committed
Issue #8035: urllib: Fix a bug where the client could remain stuck after a
redirection or an error.
2 parents 6099a03 + cf53ae2 commit 3c4dcea

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/urllib/request.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,6 @@ def http_error(self, url, fp, errcode, errmsg, headers, data=None):
17621762

17631763
def http_error_default(self, url, fp, errcode, errmsg, headers):
17641764
"""Default error handler: close the connection and raise IOError."""
1765-
void = fp.read()
17661765
fp.close()
17671766
raise HTTPError(url, errcode, errmsg, headers, None)
17681767

@@ -1951,7 +1950,6 @@ def redirect_internal(self, url, fp, errcode, errmsg, headers, data):
19511950
newurl = headers['uri']
19521951
else:
19531952
return
1954-
void = fp.read()
19551953
fp.close()
19561954

19571955
# In case the server sent a relative URL, join with original:

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ Core and Builtins
419419
Library
420420
-------
421421

422+
- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
423+
redirection or an error.
424+
422425
- Issue #13560: os.strerror() now uses the current locale encoding instead of
423426
UTF-8.
424427

0 commit comments

Comments
 (0)