Skip to content
Permalink
Browse files Browse the repository at this point in the history
PROTON-1157: fail if amqps: scheme is specified but SSL is not available
  • Loading branch information
kgiusti committed Mar 9, 2016
1 parent 747ee17 commit a058585
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions proton-c/bindings/python/proton/reactor.py
Expand Up @@ -526,7 +526,9 @@ def _connect(self, connection):
transport.bind(connection)
if self.heartbeat:
transport.idle_timeout = self.heartbeat
if url.scheme == 'amqps' and self.ssl_domain:
if url.scheme == 'amqps':
if not self.ssl_domain:
raise SSLUnavailable("amqps: SSL libraries not found")
self.ssl = SSL(transport, self.ssl_domain)
self.ssl.peer_hostname = url.host

Expand Down Expand Up @@ -693,6 +695,8 @@ def connect(self, url=None, urls=None, address=None, handler=None, reconnect=Non
connector.reconnect = reconnect
elif reconnect is None:
connector.reconnect = Backoff()
# use container's default client domain if none specified. This is
# only necessary of the URL specifies the "amqps:" scheme
connector.ssl_domain = ssl_domain or (self.ssl and self.ssl.client)
conn._session_policy = SessionPerConnection() #todo: make configurable
conn.open()
Expand Down Expand Up @@ -821,8 +825,12 @@ def listen(self, url, ssl_domain=None):
url = Url(url)
acceptor = self.acceptor(url.host, url.port)
ssl_config = ssl_domain
if not ssl_config and url.scheme == 'amqps' and self.ssl:
ssl_config = self.ssl.server
if not ssl_config and url.scheme == 'amqps':
# use container's default server domain
if self.ssl:
ssl_config = self.ssl.server
else:
raise SSLUnavailable("amqps: SSL libraries not found")
if ssl_config:
acceptor.set_ssl_domain(ssl_config)
return acceptor
Expand Down

0 comments on commit a058585

Please sign in to comment.