]> granicus.if.org Git - python/commitdiff
issue1177: Ported Facundo's from urllib2 to urllib, accepting 2xx responses.
authorSean Reifscheider <jafo@tummy.com>
Wed, 19 Sep 2007 07:52:56 +0000 (07:52 +0000)
committerSean Reifscheider <jafo@tummy.com>
Wed, 19 Sep 2007 07:52:56 +0000 (07:52 +0000)
Lib/urllib.py

index 5f3ec3c1602805055278d055eee5d643306a4e97..96115fbe50d206ba3e3239eabed6e2e2725cedfc 100644 (file)
@@ -340,7 +340,9 @@ class URLopener:
             # something went wrong with the HTTP status line
             raise IOError, ('http protocol error', 0,
                             'got a bad status line', None)
-        if errcode == 200:
+        # According to RFC 2616, "2xx" code indicates that the client's
+        # request was successfully received, understood, and accepted.
+        if not (200 <= errcode < 300):
             return addinfourl(fp, headers, "http:" + url)
         else:
             if data is None: