(self)
| 580 | |
| 581 | |
| 582 | def test_https_sni(self): |
| 583 | if ssl is None: |
| 584 | self.skipTest("ssl module required") |
| 585 | if not ssl.HAS_SNI: |
| 586 | self.skipTest("SNI support required in OpenSSL") |
| 587 | sni_name = None |
| 588 | def cb_sni(ssl_sock, server_name, initial_context): |
| 589 | nonlocal sni_name |
| 590 | sni_name = server_name |
| 591 | context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) |
| 592 | context.set_servername_callback(cb_sni) |
| 593 | handler = self.start_https_server(context=context, certfile=CERT_localhost) |
| 594 | context = ssl.create_default_context(cafile=CERT_localhost) |
| 595 | self.urlopen("https://localhost:%s" % handler.port, context=context) |
| 596 | self.assertEqual(sni_name, "localhost") |
| 597 | |
| 598 | |
| 599 | def test_sending_headers(self): |
nothing calls this directly
no test coverage detected