diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-07-01 07:07:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 07:07:44 (GMT) |
commit | ee72dda9616258b57c19eb5af00f3e80a3fb8e22 (patch) | |
tree | 9dbd2e5796e8f6d265ef932798f836db7686f8af /Lib/test/test_httplib.py | |
parent | c2684c6d62978e9ce8256c3c7744d0332a2abe4c (diff) | |
download | cpython-ee72dda9616258b57c19eb5af00f3e80a3fb8e22.zip cpython-ee72dda9616258b57c19eb5af00f3e80a3fb8e22.tar.gz cpython-ee72dda9616258b57c19eb5af00f3e80a3fb8e22.tar.bz2 |
[3.8] bpo-37440: Enable TLS 1.3 post-handshake auth in http.client (GH-14448) (GH-14495)
Post-handshake authentication is required for conditional client cert authentication with TLS 1.3.
https://bugs.python.org/issue37440
(cherry picked from commit d1bd6e79da1ee56dc1b902d804216ffd267399db)
Co-authored-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue37440
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r-- | Lib/test/test_httplib.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 968cbd8..9148169 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1745,6 +1745,24 @@ class HTTPSTest(TestCase): self.assertEqual(h, c.host) self.assertEqual(p, c.port) + def test_tls13_pha(self): + import ssl + if not ssl.HAS_TLSv1_3: + self.skipTest('TLS 1.3 support required') + # just check status of PHA flag + h = client.HTTPSConnection('localhost', 443) + self.assertTrue(h._context.post_handshake_auth) + + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self.assertFalse(context.post_handshake_auth) + h = client.HTTPSConnection('localhost', 443, context=context) + self.assertIs(h._context, context) + self.assertFalse(h._context.post_handshake_auth) + + h = client.HTTPSConnection('localhost', 443, context=context, + cert_file=CERT_localhost) + self.assertTrue(h._context.post_handshake_auth) + class RequestBodyTest(TestCase): """Test cases where a request includes a message body.""" |