Commit 765fdf61 authored by fedor.brunner's avatar fedor.brunner

BOSH doesn't support channel binding.

BOSH (XEP-0124) uses short lived HTTPS connections for encryption.
Channel binding requires long lived TLS connection, therefor
doesn't work with XMPP over BOSH.

Fixes #22
parent 13598441
......@@ -495,9 +495,10 @@ class NonBlockingClient:
self._channel_binding = None
if self.connected in ('ssl', 'tls'):
try:
self._channel_binding = self.Connection.NonBlockingTLS.get_channel_binding()
# TLS handshake is finished so channel binding data muss exist
assert (self._channel_binding != None)
if self.protocol_type != 'BOSH':
self._channel_binding = self.Connection.NonBlockingTLS.get_channel_binding()
# TLS handshake is finished so channel binding data muss exist
assert (self._channel_binding != None)
except NotImplementedError:
pass
if auth_mechs == None:
......
......@@ -508,7 +508,10 @@ class NonBlockingTLS(PlugIn):
Get channel binding data. RFC 5929
"""
sslObj = self._owner._sslObj
try:
return sslObj.get_channel_binding()
try:
if USE_PYOPENSSL:
return sslObj.get_finished()
else:
return sslObj.get_channel_binding()
except AttributeError:
raise NotImplementedError
......@@ -555,7 +555,7 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
return None
self.sendbuff = self.sendqueue.pop(0)
try:
send_count = self._send(self.sendbuff)
send_count = self._send(self.sendbuff.encode("utf-8"))
if send_count:
sent_data = self.sendbuff[:send_count]
self.sendbuff = self.sendbuff[send_count:]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment