(self)
| 570 | self.assertEqual(data, b"we care a bit") |
| 571 | |
| 572 | def test_https_sni(self): |
| 573 | if ssl is None: |
| 574 | self.skipTest("ssl module required") |
| 575 | if not ssl.HAS_SNI: |
| 576 | self.skipTest("SNI support required in OpenSSL") |
| 577 | sni_name = None |
| 578 | def cb_sni(ssl_sock, server_name, initial_context): |
| 579 | nonlocal sni_name |
| 580 | sni_name = server_name |
| 581 | context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) |
| 582 | context.set_servername_callback(cb_sni) |
| 583 | handler = self.start_https_server(context=context, certfile=CERT_localhost) |
| 584 | context = ssl.create_default_context(cafile=CERT_localhost) |
| 585 | self.urlopen("https://localhost:%s" % handler.port, context=context) |
| 586 | self.assertEqual(sni_name, "localhost") |
| 587 | |
| 588 | def test_sending_headers(self): |
| 589 | handler = self.start_server() |
nothing calls this directly
no test coverage detected