]> granicus.if.org Git - python/commitdiff
[Patch #988504] Fix HTTP error handling via a patch from John J. Lee
authorAndrew M. Kuchling <amk@amk.ca>
Sat, 10 Jul 2004 15:34:34 +0000 (15:34 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Sat, 10 Jul 2004 15:34:34 +0000 (15:34 +0000)
Lib/urllib2.py

index 69f5e040484b8b947d0a0d3dc849111ff67480c2..a9c1c63a369b64475c5d59faac5d359596876a94 100644 (file)
@@ -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):