[Python-checkins] r58247 - python/trunk/Lib/urllib.py

georg.brandl python-checkins at python.org
Mon Sep 24 20:08:24 CEST 2007


Author: georg.brandl
Date: Mon Sep 24 20:08:24 2007
New Revision: 58247

Modified:
   python/trunk/Lib/urllib.py
Log:
#1177: accept 2xx responses for https too, not only http.


Modified: python/trunk/Lib/urllib.py
==============================================================================
--- python/trunk/Lib/urllib.py	(original)
+++ python/trunk/Lib/urllib.py	Mon Sep 24 20:08:24 2007
@@ -435,7 +435,9 @@
                 # 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:


More information about the Python-checkins mailing list