Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
5516d597 by lovetox at 2022-05-28T11:08:56+02:00
fix: Client: Disconnect after stream restart in Login mode
RFC 6120 states that ending the stream after successful auth is not
allowed because the stream is considererd ended. Sending </stream:stream>
would run into a parser error. So we restart the stream and end it afterwards.
- - - - -
1 changed file:
- nbxmpp/client.py
Changes:
=====================================
nbxmpp/client.py
=====================================
@@ -645,6 +645,11 @@ class Client(Observable):
# other connection methods if an error happensafterwards
self._connect_successful = True
+ if self._stream_authenticated and self._mode.is_login_test:
+ self.notify('login-successful')
+ self.disconnect()
+ return
+
self.state = StreamState.WAIT_FOR_FEATURES
elif self.state == StreamState.WAIT_FOR_FEATURES:
@@ -687,14 +692,6 @@ class Client(Observable):
elif self.state == StreamState.AUTH_SUCCESSFUL:
self._stream_authenticated = True
- if self._mode.is_login_test:
- self.notify('login-successful')
- # Reset parser because we will receive a new stream header
- # which will otherwise lead to a parsing error
- self._dispatcher.reset_parser()
- self.disconnect()
- return
-
self._start_stream()
elif self.state == StreamState.AUTH_FAILED:
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/5516d597e8158fd746a4d501d05cc6a76ed1bc70
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/5516d597e8158fd746a4d501d05cc6a76ed1bc70
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits