Skip to content
Snippets Groups Projects
Commit c69b4e90 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

detect and handle incorrect stream start. Fixes #4499

parent 4728a3d9
No related branches found
No related tags found
No related merge requests found
......@@ -141,6 +141,10 @@ class Dispatcher(PlugIn):
self.DEBUG('Invalid XML received from server. Forcing disconnect.', 'error')
self._owner.Connection.pollend()
return 0
except ValueError, e:
self.DEBUG(str(e), 'error')
self._owner.Connection.pollend()
return 0
if len(self._pendingExceptions) > 0:
_pendingException = self._pendingExceptions.pop()
raise _pendingException[0], _pendingException[1], _pendingException[2]
......
......@@ -386,7 +386,11 @@ class NodeBuilder:
else:
self._document_attrs[attr] = val
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:
self._ptr.parent.data.append('')
self.last_is_data = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment