mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't contain a valid HTTP status line.
This commit is contained in:
parent
90fd76a2b4
commit
f66b6039c1
3 changed files with 21 additions and 0 deletions
|
@ -122,6 +122,15 @@ class urlopen_HttpTests(unittest.TestCase):
|
|||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
def test_empty_socket(self):
|
||||
"""urlopen() raises IOError if the underlying socket does not send any
|
||||
data. (#1680230) """
|
||||
self.fakehttp('')
|
||||
try:
|
||||
self.assertRaises(IOError, urllib.urlopen, 'http://something')
|
||||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
class urlretrieve_FileTests(unittest.TestCase):
|
||||
"""Test urllib.urlretrieve() on local files"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue