summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2004-07-10 15:34:34 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2004-07-10 15:34:34 (GMT)
commitf9ea7c067a5278d02b28e567a99f850a136d29c8 (patch)
tree28015d3868f6d610748b4edc0af6976827fb33d6 /Lib/urllib2.py
parent42851ab4905aea2e1253fa46bbb718abddeeab84 (diff)
downloadcpython-f9ea7c067a5278d02b28e567a99f850a136d29c8.zip
cpython-f9ea7c067a5278d02b28e567a99f850a136d29c8.tar.gz
cpython-f9ea7c067a5278d02b28e567a99f850a136d29c8.tar.bz2
[Patch #988504] Fix HTTP error handling via a patch from John J. Lee
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 69f5e04..a9c1c63 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -996,16 +996,12 @@ class AbstractHTTPHandler(BaseHandler):
except socket.error, err: # XXX what error?
raise URLError(err)
- if r.status in (200, 206):
- # Pick apart the HTTPResponse object to get the addinfourl
- # object initialized properly
- resp = addinfourl(r.fp, r.msg, req.get_full_url())
- resp.code = r.status
- resp.msg = r.reason
- return resp
- else:
- return self.parent.error("http", req, r.fp, r.status, r.msg,
- r.msg.dict)
+ # Pick apart the HTTPResponse object to get the addinfourl
+ # object initialized properly
+ resp = addinfourl(r.fp, r.msg, req.get_full_url())
+ resp.code = r.status
+ resp.msg = r.reason
+ return resp
class HTTPHandler(AbstractHTTPHandler):