Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROTON-1355: Set ssl.peer_hostname to virtual_host if specified #90

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion proton-c/bindings/python/proton/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def _connect(self, connection, reactor):
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
self.ssl.peer_hostname = self.virtual_host if self.virtual_host != None else url.host
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that None has truthiness of false so this can be written more simply as:
... = self.virtual_host if self.virtual_host else url.host

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I chose to write it this way to be consistent with the rest of the code which seems to explicitly check for None.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually you can write it even more clearly ...
... = self.virtual_host or url.host


def on_connection_local_open(self, event):
self._connect(event.connection, event.reactor)
Expand Down