]> granicus.if.org Git - python/commitdiff
[Bug #912845] urllib2 only checks for a 200 return code, but 206 is also legal if...
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 29 Jun 2004 13:19:19 +0000 (13:19 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 29 Jun 2004 13:19:19 +0000 (13:19 +0000)
(Actually, should the first 'if' statement be modified to allow any 2xx status code?)

Lib/urllib2.py

index 301b5dee78303f558c9f4817e6caee00a97c9162..69f5e040484b8b947d0a0d3dc849111ff67480c2 100644 (file)
@@ -468,7 +468,7 @@ class HTTPErrorProcessor(BaseHandler):
     def http_response(self, request, response):
         code, msg, hdrs = response.code, response.msg, response.info()
 
-        if code != 200:
+        if code not in (200, 206):
             response = self.parent.error(
                 'http', request, response, code, msg, hdrs)
 
@@ -996,7 +996,7 @@ class AbstractHTTPHandler(BaseHandler):
         except socket.error, err: # XXX what error?
             raise URLError(err)
 
-        if r.status == 200:
+        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())