From: Bob Halley Date: Fri, 12 Jun 2020 15:01:17 +0000 (-0700) Subject: Add TLS for asyncio. X-Git-Tag: v2.0.0rc1~112^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cae7c792bda2903fb3c28166182fb4b81e7ae400;p=thirdparty%2Fdnspython.git Add TLS for asyncio. --- diff --git a/dns/_asyncio_backend.py b/dns/_asyncio_backend.py index 07e9e5e2..5f14c4a3 100644 --- a/dns/_asyncio_backend.py +++ b/dns/_asyncio_backend.py @@ -99,7 +99,7 @@ class StreamSocket(dns._asyncbackend.DatagramSocket): pass async def getpeername(self): - return self.reader.get_extra_info('peername') + return self.writer.get_extra_info('peername') class Backend(dns._asyncbackend.Backend): @@ -119,9 +119,11 @@ class Backend(dns._asyncbackend.Backend): (r, w) = await _maybe_wait_for( asyncio.open_connection(destination[0], destination[1], + ssl=ssl_context, family=af, proto=proto, - local_addr=source), + local_addr=source, + server_hostname=server_hostname), timeout) return StreamSocket(af, r, w) raise NotImplementedError(f'unsupported socket type {socktype}')