diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-28 16:26:33 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-28 16:26:33 (GMT) |
| commit | 63cc99d9a6cf4751bd75b6bc32416fdb3a98440b (patch) | |
| tree | 45821cb43ac9bc17ab7e4ea94d425c1d59a730ab /Lib/test/test_ssl.py | |
| parent | e891de3cbba302b3633635c91787b5ffbd9684e2 (diff) | |
| download | cpython-63cc99d9a6cf4751bd75b6bc32416fdb3a98440b.zip cpython-63cc99d9a6cf4751bd75b6bc32416fdb3a98440b.tar.gz cpython-63cc99d9a6cf4751bd75b6bc32416fdb3a98440b.tar.bz2 | |
Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl module, rather than silently let them emit clear text data.
Diffstat (limited to 'Lib/test/test_ssl.py')
| -rw-r--r-- | Lib/test/test_ssl.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 6723865..c1c3384 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -232,6 +232,13 @@ class BasicSocketTests(unittest.TestCase): self.assertRaises(socket.error, ss.send, b'x') self.assertRaises(socket.error, ss.sendto, b'x', ('0.0.0.0', 0)) + def test_unsupported_dtls(self): + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.addCleanup(s.close) + with self.assertRaises(NotImplementedError) as cx: + ssl.wrap_socket(s, cert_reqs=ssl.CERT_NONE) + self.assertEqual(str(cx.exception), "only stream sockets are supported") + class NetworkedTests(unittest.TestCase): |
