diff options
| author | Benjamin Peterson <benjamin@python.org> | 2015-01-26 04:34:42 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2015-01-26 04:34:42 (GMT) |
| commit | bfd976fc171bd89080ecbbb2d64ed1bc315fa2a9 (patch) | |
| tree | db255151ccdb90c34c87588d226528b166ce7d58 /Lib/test/test_httplib.py | |
| parent | 9a6d32e78cd8f73f957d6c8eac04fb3f834fc261 (diff) | |
| download | cpython-bfd976fc171bd89080ecbbb2d64ed1bc315fa2a9.zip cpython-bfd976fc171bd89080ecbbb2d64ed1bc315fa2a9.tar.gz cpython-bfd976fc171bd89080ecbbb2d64ed1bc315fa2a9.tar.bz2 | |
simply ignore headers with no name (#19996)
Patch by Cory Benfield.
Diffstat (limited to 'Lib/test/test_httplib.py')
| -rw-r--r-- | Lib/test/test_httplib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 0892d5a..c071411 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -164,6 +164,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 = httplib.HTTPResponse(sock) + resp.begin() + + self.assertEqual(resp.getheader('First'), 'val') + self.assertEqual(resp.getheader('Second'), 'val') + class BasicTest(TestCase): def test_status_lines(self): |
