]> granicus.if.org Git - python/commitdiff
#1177: accept 2xx responses for https too, not only http.
authorGeorg Brandl <georg@python.org>
Mon, 24 Sep 2007 18:08:24 +0000 (18:08 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 24 Sep 2007 18:08:24 +0000 (18:08 +0000)
Lib/urllib.py

index 96115fbe50d206ba3e3239eabed6e2e2725cedfc..ad0e72b76845a822355d95aea87cfb33f9205287 100644 (file)
@@ -435,7 +435,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, "https:" + url)
             else:
                 if data is None: