Using socketserver to create and manage SSL connections.
(self)
| 3499 | s.close() |
| 3500 | |
| 3501 | def test_socketserver(self): |
| 3502 | """Using socketserver to create and manage SSL connections.""" |
| 3503 | server = make_https_server(self, certfile=SIGNED_CERTFILE) |
| 3504 | # try to connect |
| 3505 | if support.verbose: |
| 3506 | sys.stdout.write('\n') |
| 3507 | # Get this test file itself: |
| 3508 | with open(__file__, 'rb') as f: |
| 3509 | d1 = f.read() |
| 3510 | d2 = '' |
| 3511 | # now fetch the same data from the HTTPS server |
| 3512 | url = f'https://localhost:{server.port}/test_ssl.py' |
| 3513 | context = ssl.create_default_context(cafile=SIGNING_CA) |
| 3514 | f = urllib.request.urlopen(url, context=context) |
| 3515 | try: |
| 3516 | dlen = f.info().get("content-length") |
| 3517 | if dlen and (int(dlen) > 0): |
| 3518 | d2 = f.read(int(dlen)) |
| 3519 | if support.verbose: |
| 3520 | sys.stdout.write( |
| 3521 | " client: read %d bytes from remote server '%s'\n" |
| 3522 | % (len(d2), server)) |
| 3523 | finally: |
| 3524 | f.close() |
| 3525 | self.assertEqual(d1, d2) |
| 3526 | |
| 3527 | def test_asyncore_server(self): |
| 3528 | """Check the example asyncore integration.""" |
nothing calls this directly
no test coverage detected