Alexey patch that allows discover that server is violating RFC by not restarting stream after TLS start.
If server did such thing xmpppy will not crash unpredictely but will issue a appropriate exception.
This commit is contained in:
parent
61558b8942
commit
aa9de25923
|
@ -89,6 +89,7 @@ class Dispatcher(PlugIn):
|
||||||
self.Stream=simplexml.NodeBuilder()
|
self.Stream=simplexml.NodeBuilder()
|
||||||
self.Stream._dispatch_depth=2
|
self.Stream._dispatch_depth=2
|
||||||
self.Stream.dispatch=self.dispatch
|
self.Stream.dispatch=self.dispatch
|
||||||
|
self.Stream.stream_header_received=self._check_stream_start
|
||||||
self._owner.debug_flags.append(simplexml.DBG_NODEBUILDER)
|
self._owner.debug_flags.append(simplexml.DBG_NODEBUILDER)
|
||||||
self.Stream.DEBUG=self._owner.DEBUG
|
self.Stream.DEBUG=self._owner.DEBUG
|
||||||
self.Stream.features=None
|
self.Stream.features=None
|
||||||
|
@ -99,6 +100,10 @@ class Dispatcher(PlugIn):
|
||||||
self._metastream.setAttr('to',self._owner.Server)
|
self._metastream.setAttr('to',self._owner.Server)
|
||||||
self._owner.send("<?xml version='1.0'?>%s>"%str(self._metastream)[:-2])
|
self._owner.send("<?xml version='1.0'?>%s>"%str(self._metastream)[:-2])
|
||||||
|
|
||||||
|
def _check_stream_start(self,ns,tag,attrs):
|
||||||
|
if ns<>NS_STREAMS or tag<>'stream':
|
||||||
|
raise ValueError('Incorrect stream start: (%s,%s). Terminating.'%(tag,ns))
|
||||||
|
|
||||||
def Process(self, timeout=0):
|
def Process(self, timeout=0):
|
||||||
""" Check incoming stream for data waiting. If "timeout" is positive - block for as max. this time.
|
""" Check incoming stream for data waiting. If "timeout" is positive - block for as max. this time.
|
||||||
Returns:
|
Returns:
|
||||||
|
|
Loading…
Reference in New Issue