Skip to content

Commit 2350249

Browse files
committed
stomp.py: use six.text_type() instead of decode()
b60f601 added support for SNI to the STOMP protocol. The optionsForClientTLS() API states that the hostname argument must be in unicode format, but under Python 3 the argument is a str which doesn't provide a decode() method. Use six.text_type() to ensure the proper type is always used. This was reported in #69.
1 parent da971e5 commit 2350249

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

moksha.hub/moksha/hub/stomp/stomp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def connect(self, address, key=None, crt=None):
9191
import service_identity
9292
# connect SSL/TLS with SNI support (https://twistedmatrix.com/trac/ticket/5190)
9393
# This requires service_identity module: https://pypi.python.org/pypi/service_identity
94-
ssl_context = ssl.optionsForClientTLS(host.decode('utf-8'), clientCertificate=client_cert)
94+
ssl_context = ssl.optionsForClientTLS(six.text_type(host), clientCertificate=client_cert)
9595
except ImportError:
9696
log.warn("Connecting without SNI support due to absence of service_identity module.")
9797
ssl_context = client_cert.options()

0 commit comments

Comments
 (0)