diff options
| author | Georg Brandl <georg@python.org> | 2007-03-14 08:27:52 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2007-03-14 08:27:52 (GMT) |
| commit | f66b6039c11fb8f9162867afb7e6574652637a7b (patch) | |
| tree | 08135659eca3719afcce22a6fdf4a84d6f6fad34 /Lib/test/test_urllib.py | |
| parent | 90fd76a2b49353fc43ab48b330a6e752ed9a75ba (diff) | |
| download | cpython-f66b6039c11fb8f9162867afb7e6574652637a7b.zip cpython-f66b6039c11fb8f9162867afb7e6574652637a7b.tar.gz cpython-f66b6039c11fb8f9162867afb7e6574652637a7b.tar.bz2 | |
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.
Diffstat (limited to 'Lib/test/test_urllib.py')
| -rw-r--r-- | Lib/test/test_urllib.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 4579c47..294ed5e 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -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""" |
