Using socketserver to create and manage SSL connections.
(self)
| 3782 | s.close() |
| 3783 | |
| 3784 | def test_socketserver(self): |
| 3785 | """Using socketserver to create and manage SSL connections.""" |
| 3786 | server = make_https_server(self, certfile=SIGNED_CERTFILE) |
| 3787 | # try to connect |
| 3788 | if support.verbose: |
| 3789 | sys.stdout.write('\n') |
| 3790 | # Get this test file itself: |
| 3791 | with open(__file__, 'rb') as f: |
| 3792 | d1 = f.read() |
| 3793 | d2 = '' |
| 3794 | # now fetch the same data from the HTTPS server |
| 3795 | url = f'https://localhost:{server.port}/test_ssl.py' |
| 3796 | context = ssl.create_default_context(cafile=SIGNING_CA) |
| 3797 | f = urllib.request.urlopen(url, context=context) |
| 3798 | try: |
| 3799 | dlen = f.info().get("content-length") |
| 3800 | if dlen and (int(dlen) > 0): |
| 3801 | d2 = f.read(int(dlen)) |
| 3802 | if support.verbose: |
| 3803 | sys.stdout.write( |
| 3804 | " client: read %d bytes from remote server '%s'\n" |
| 3805 | % (len(d2), server)) |
| 3806 | finally: |
| 3807 | f.close() |
| 3808 | self.assertEqual(d1, d2) |
| 3809 | |
| 3810 | def test_asyncore_server(self): |
| 3811 | """Check the example asyncore integration.""" |
nothing calls this directly
no test coverage detected