detect and handle incorrect stream start. Fixes #4499
This commit is contained in:
parent
4728a3d960
commit
c69b4e90b6
|
@ -141,6 +141,10 @@ class Dispatcher(PlugIn):
|
||||||
self.DEBUG('Invalid XML received from server. Forcing disconnect.', 'error')
|
self.DEBUG('Invalid XML received from server. Forcing disconnect.', 'error')
|
||||||
self._owner.Connection.pollend()
|
self._owner.Connection.pollend()
|
||||||
return 0
|
return 0
|
||||||
|
except ValueError, e:
|
||||||
|
self.DEBUG(str(e), 'error')
|
||||||
|
self._owner.Connection.pollend()
|
||||||
|
return 0
|
||||||
if len(self._pendingExceptions) > 0:
|
if len(self._pendingExceptions) > 0:
|
||||||
_pendingException = self._pendingExceptions.pop()
|
_pendingException = self._pendingExceptions.pop()
|
||||||
raise _pendingException[0], _pendingException[1], _pendingException[2]
|
raise _pendingException[0], _pendingException[1], _pendingException[2]
|
||||||
|
|
|
@ -386,7 +386,11 @@ class NodeBuilder:
|
||||||
else:
|
else:
|
||||||
self._document_attrs[attr] = val
|
self._document_attrs[attr] = val
|
||||||
ns = self._document_nsp.get(nsp, 'http://www.gajim.org/xmlns/undeclared-root')
|
ns = self._document_nsp.get(nsp, 'http://www.gajim.org/xmlns/undeclared-root')
|
||||||
self.stream_header_received(ns, name, attrs)
|
try:
|
||||||
|
self.stream_header_received(ns, name, attrs)
|
||||||
|
except ValueError, e:
|
||||||
|
self._document_attrs = None
|
||||||
|
raise ValueError(str(e))
|
||||||
if not self.last_is_data and self._ptr.parent:
|
if not self.last_is_data and self._ptr.parent:
|
||||||
self._ptr.parent.data.append('')
|
self._ptr.parent.data.append('')
|
||||||
self.last_is_data = 0
|
self.last_is_data = 0
|
||||||
|
|
Loading…
Reference in New Issue