mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
issue1177: Ported Facundo's from urllib2 to urllib, accepting 2xx responses.
This commit is contained in:
parent
5a5bc7b10d
commit
a1afbf617d
1 changed files with 3 additions and 1 deletions
|
@ -340,7 +340,9 @@ class URLopener:
|
||||||
# something went wrong with the HTTP status line
|
# something went wrong with the HTTP status line
|
||||||
raise IOError, ('http protocol error', 0,
|
raise IOError, ('http protocol error', 0,
|
||||||
'got a bad status line', None)
|
'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)
|
return addinfourl(fp, headers, "http:" + url)
|
||||||
else:
|
else:
|
||||||
if data is None:
|
if data is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue