diff options
author | Éric Araujo <merwok@netwok.org> | 2011-07-28 23:08:11 +0200 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-07-28 23:08:11 +0200 |
commit | cf534817adc49b2562d175fabd3e3992d25063fe (patch) | |
tree | d2cb18e71d6b5cc25384146751b00c2172a327b6 /Lib/test/test_urllib2net.py | |
parent | 9e1af03fbb2a9fc1472ac866add02c99b0c88b16 (diff) | |
parent | fc662ddda2bfd43b10c0a4f8a814e36445f22515 (diff) | |
download | cpython-git-cf534817adc49b2562d175fabd3e3992d25063fe.tar.gz |
Branch merge
Diffstat (limited to 'Lib/test/test_urllib2net.py')
-rw-r--r-- | Lib/test/test_urllib2net.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index a475f56402..cd225c90fd 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -174,6 +174,22 @@ class OtherNetworkTests(unittest.TestCase): opener.open(request) self.assertEqual(request.get_header('User-agent'),'Test-Agent') + def test_sites_no_connection_close(self): + # Some sites do not send Connection: close header. + # Verify that those work properly. (#issue12576) + + try: + with urllib.request.urlopen('http://www.imdb.com') as res: + pass + except ValueError as e: + self.fail("urlopen failed for sites not sending Connection:close") + else: + self.assertTrue(res) + + req = urllib.request.urlopen('http://www.imdb.com') + res = req.read() + self.assertTrue(res) + def _test_urls(self, urls, handlers, retry=True): import time import logging |