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

Skip to content

Commit cf53ae2

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.
1 parent a94a0e9 commit cf53ae2

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
@@ -1732,7 +1732,6 @@ def http_error(self, url, fp, errcode, errmsg, headers, data=None):
17321732

17331733
def http_error_default(self, url, fp, errcode, errmsg, headers):
17341734
"""Default error handler: close the connection and raise IOError."""
1735-
void = fp.read()
17361735
fp.close()
17371736
raise HTTPError(url, errcode, errmsg, headers, None)
17381737

@@ -1923,7 +1922,6 @@ def redirect_internal(self, url, fp, errcode, errmsg, headers, data):
19231922
newurl = headers['uri']
19241923
else:
19251924
return
1926-
void = fp.read()
19271925
fp.close()
19281926

19291927
# 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
@@ -97,6 +97,9 @@ Core and Builtins
9797
Library
9898
-------
9999

100+
- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
101+
redirection or an error.
102+
100103
- Issue #10350: Read and save errno before calling a function which might
101104
overwrite it. Original patch by Hallvard B Furuseth.
102105

0 commit comments

Comments
 (0)