escape from sslerror due to broken protocol
This commit is contained in:
parent
e3ba73be74
commit
873bedd221
|
@ -127,11 +127,10 @@ class NBCommonClient(CommonClient):
|
|||
def _on_connected(self):
|
||||
self.connected = 'tcp'
|
||||
if (self._Ssl is None and self.Connection.getPort() in (5223, 443)) or self._Ssl:
|
||||
try:
|
||||
transports_nb.NonBlockingTLS().PlugIn(self, now=1)
|
||||
self.connected = 'ssl'
|
||||
except socket.sslerror:
|
||||
transports_nb.NonBlockingTLS().PlugIn(self, now=1)
|
||||
if not self.Connection: # ssl error, stream is closed
|
||||
return
|
||||
self.connected = 'ssl'
|
||||
self.onreceive(self._on_receive_document_attrs)
|
||||
dispatcher_nb.Dispatcher().PlugIn(self)
|
||||
|
||||
|
@ -194,6 +193,8 @@ class NonBlockingClient(NBCommonClient):
|
|||
self.isplugged = True
|
||||
self.onreceive(None)
|
||||
transports_nb.NonBlockingTLS().PlugIn(self)
|
||||
if not self.Connection: # ssl error, stream is closed
|
||||
return True
|
||||
if not self.Dispatcher.Stream._document_attrs.has_key('version') or \
|
||||
not self.Dispatcher.Stream._document_attrs['version']=='1.0':
|
||||
self._is_connected()
|
||||
|
|
|
@ -372,7 +372,11 @@ class NonBlockingTLS(PlugIn):
|
|||
DBG_LINE='NonBlockingTLS'
|
||||
self.on_tls_start = on_tls_start
|
||||
if now:
|
||||
res = self._startSSL()
|
||||
try:
|
||||
res = self._startSSL()
|
||||
except Exception, e:
|
||||
self._owner.socket.pollend()
|
||||
return
|
||||
self.tls_start()
|
||||
return res
|
||||
if self._owner.Dispatcher.Stream.features:
|
||||
|
@ -434,7 +438,11 @@ class NonBlockingTLS(PlugIn):
|
|||
self.DEBUG('Got starttls response: ' + self.starttls,'error')
|
||||
return
|
||||
self.DEBUG('Got starttls proceed response. Switching to TLS/SSL...','ok')
|
||||
self._startSSL()
|
||||
try:
|
||||
self._startSSL()
|
||||
except Exception, e:
|
||||
self._owner.socket.pollend()
|
||||
return
|
||||
self._owner.Dispatcher.PlugOut()
|
||||
dispatcher_nb.Dispatcher().PlugIn(self._owner)
|
||||
|
||||
|
|
Loading…
Reference in New Issue