summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httplib.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-01-26 04:30:30 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-01-26 04:30:30 (GMT)
commit155ceaa454ad9a623cade5ed326e6e1e70ce109d (patch)
treea670befde15514295bfa597d56d55fa9549dfa49 /Lib/test/test_httplib.py
parent7e4b9057b3180ed1b7b26dc8f9a2d2162d4e83b0 (diff)
downloadcpython-155ceaa454ad9a623cade5ed326e6e1e70ce109d.zip
cpython-155ceaa454ad9a623cade5ed326e6e1e70ce109d.tar.gz
cpython-155ceaa454ad9a623cade5ed326e6e1e70ce109d.tar.bz2
handle headers with no key (closes #19996)
Patch by Cory Benfield.
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r--Lib/test/test_httplib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index fa962b3..3fc3466 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -167,6 +167,16 @@ class HeaderTests(TestCase):
conn.request('GET', '/foo')
self.assertTrue(sock.data.startswith(expected))
+ def test_malformed_headers_coped_with(self):
+ # Issue 19996
+ body = "HTTP/1.1 200 OK\r\nFirst: val\r\n: nval\r\nSecond: val\r\n\r\n"
+ sock = FakeSocket(body)
+ resp = client.HTTPResponse(sock)
+ resp.begin()
+
+ self.assertEqual(resp.getheader('First'), 'val')
+ self.assertEqual(resp.getheader('Second'), 'val')
+
class BasicTest(TestCase):
def test_status_lines(self):