pass SSL context to TLS connections
This commit is contained in:
parent
aaa45846d3
commit
1994ed3025
1 changed files with 4 additions and 1 deletions
|
@ -298,12 +298,15 @@ class XMLStream(asyncio.BaseProtocol):
|
||||||
# and try (host, port) as a last resort
|
# and try (host, port) as a last resort
|
||||||
self.dns_answers = None
|
self.dns_answers = None
|
||||||
|
|
||||||
|
if self.use_ssl:
|
||||||
|
ssl_context = self.get_ssl_context()
|
||||||
|
|
||||||
yield from asyncio.sleep(self.connect_loop_wait)
|
yield from asyncio.sleep(self.connect_loop_wait)
|
||||||
try:
|
try:
|
||||||
yield from self.loop.create_connection(lambda: self,
|
yield from self.loop.create_connection(lambda: self,
|
||||||
self.address[0],
|
self.address[0],
|
||||||
self.address[1],
|
self.address[1],
|
||||||
ssl=self.use_ssl,
|
ssl=ssl_context,
|
||||||
server_hostname=self.default_domain if self.use_ssl else None)
|
server_hostname=self.default_domain if self.use_ssl else None)
|
||||||
except Socket.gaierror as e:
|
except Socket.gaierror as e:
|
||||||
self.event('connection_failed',
|
self.event('connection_failed',
|
||||||
|
|
Loading…
Reference in a new issue