148 Commits

Author SHA1 Message Date
mathieui
3d0b09e2e2 xmlstream: prevent stanza parsing from crashing the whole thing
If an error happened while parsing a stanza, it would bring the whole
program down and disconnect instead of logging an error. And the DEBUG
log happened afterwards (so, never).
2024-12-14 15:52:51 +01:00
mathieui
c495eb73fc xmlstream: add stanza_not_sent event (fixes #3559) 2024-12-11 22:01:34 +01:00
mathieui
5a5b36ab39 xmlstream: make mypy even happier 2024-02-09 22:58:20 +01:00
mathieui
f151f0a7ab xmlstream/componentxmpp: fix some typing issues
Make mypy happier
2024-02-09 22:55:20 +01:00
mathieui
7128ea249b
Fix running process() with a timeout (closes #3505) 2024-02-02 01:00:25 +01:00
Daniel Roschka
7de5cbcf33
Fix connect parameters used for follow-up calls
XMLStream.connect() is supposed to persist the parameters
it gets called with to allow follow-up calls to call
XMLStream.connect() without any parameters to result in a connection
with the same properties as the original one. That's for example used by
XMLStream.reconnect() when establishing a new connection.

Unfortunately that was broken for some of the parameters and resulted
different TLS related settings on reconnections. This commit fixes that.
2023-12-27 11:45:04 +01:00
Emmanuel Gil Peyrot
db1fc5fbc5 xmlstream: Fix registration
This iq nonza wasn’t marked as allowed to be sent on an unauthenticated
stream.
2023-05-01 19:50:26 +02:00
Maxime “pep” Buquet
b60b1b985d
CVE-2022-45197: Fix missing certificate hostname validation
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-11-12 21:36:11 +01:00
nicoco
62701bc562 xmlstream: ignore task type (mypy)
This is not satisfying, but having gitlab pipelines running would be nice, wouldn't it?
2022-08-29 00:20:36 +02:00
Link Mauve
f7a38a028a Merge branch 'default-to-CAs' into 'master'
xmlstream: load default CA store by default

See merge request poezio/slixmpp!209
2022-07-12 13:24:32 +02:00
Maxime “pep” Buquet
90e79af18a
xmlstream: load default CA store by default
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-07-11 14:46:00 +02:00
Georg Lukas
b44ab17c8f Fix delayed reconnect after DNS failure
The XML stream will re-schedule a reconnect on socket errors, except
for DNS failures. If a user has no uplink connection, then DNS will
also fail, preventing an automatic reconnection.

This patch consolidates the two code paths and sets a maximum back-off
time of 5min (300s).
2022-06-22 11:39:44 +02:00
mathieui
f7902d056e Merge branch 'exn-invalidcabundle-arg' into 'master'
Pass in useful value when raising InvalidCABundle

See merge request poezio/slixmpp!195
2022-04-05 19:42:06 +02:00
Maxime “pep” Buquet
41afbb10df
Pass in useful value when raising InvalidCABundle
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-04-05 01:24:14 +02:00
mathieui
914ce40fd5 stream features: fix old "session" establishment
As it is and old and deprecated code path, nobody noticed that it was
broken by the new filtering code.

Fix #3468
2022-04-01 20:56:02 +02:00
mathieui
4202ed4cd5 Fix mypy in CI 2022-03-19 00:04:56 +01:00
mathieui
d15a37e146 fix: allow cancelling the run_filters coroutine
otherwise it will leak forever into the event loop and generate
tracebacks when closing it
2022-02-16 22:11:19 +01:00
mathieui
bcb4495c6d deprecate XMLStream.process() 2022-02-15 21:57:49 +01:00
Maxime “pep” Buquet
9f38c8944d
Don't break ca-bundle API just yet
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-01-03 23:36:25 +01:00
Maxime “pep” Buquet
d733c54518
Allow Xmlstream.ca_certs to be an iterable
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-01-03 10:30:09 +01:00
Maxime “pep” Buquet
90662d148e
Make Xmlstream.ca_certs an Optional[Path] instead of Optional[str]
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2021-12-28 18:28:36 +01:00
mathieui
799a6a07a9 fix: remove loop parameter when deprecated (3.10) 2021-12-13 21:31:46 +01:00
mathieui
be6dde17f1 Revert "Replace asyncio.ensure_future() with asyncio.create_task()"
This reverts commit bac6a4b2bf2fc98401e0de7168c4a5cf31b08b37.

This is not actually something we want
2021-12-13 21:25:41 +01:00
Emmanuel Gil Peyrot
bac6a4b2bf Replace asyncio.ensure_future() with asyncio.create_task()
The latter function got introduced in Python 3.7, which is conveniently
our MSPV, so let’s use that.
2021-11-18 15:33:03 +01:00
mathieui
ca1cc73c79 xmlstream: refine type check 2021-07-05 22:42:18 +02:00
mathieui
f2d7e86fc7 typing: add a bunch of type ignores
because this is too smart for mypy and I do not want to rewrite those
things right now.
2021-07-05 22:25:38 +02:00
mathieui
d6924fa7ad fix: please python 3.7 2021-07-03 12:02:36 +02:00
mathieui
db48c8f4da xmlstream: add more types 2021-07-03 11:17:15 +02:00
mathieui
9f01d368c0 refactor: remove the now obsolete future_wrapper and asyncio-related module 2021-06-28 21:01:18 +02:00
mathieui
528553be57 xmlstream: do not re-send queued stanzas on each connect
each sent stanza should be purged, obviously…
2021-05-02 18:55:14 +02:00
mathieui
0b5f6cb0a8 xmlstream: fix slow tasks scheduling
- wrong attribute used
- some mistakes in the slow tasks function
2021-04-30 19:27:30 +02:00
mathieui
a4789acbfb xmlstream: fix use of the waiting queue 2021-04-22 21:07:30 +02:00
mathieui
d4e1b68534 Allow handshake in stream.send() when not connected yet
fix #3464
2021-04-18 21:16:03 +02:00
mathieui
7057773d18 Merge branch 'tentative-fix-for-reconnect-race' into 'master'
xmlstream: do not allow stanzas outside a session

See merge request poezio/slixmpp!154
2021-04-12 19:49:10 +02:00
mathieui
fcf666e3cb Fix #3441: Do not assign ID to inbound stanzas 2021-04-09 20:40:30 +02:00
mathieui
3e5943f458 xmlstream: do not allow stanzas outside a session
except for the bind, obviously
2021-04-08 18:47:51 +02:00
mathieui
8da5310ea6 xmlstream: add a wrap() method for ensure_future 2021-02-26 00:08:56 +01:00
mathieui
babd98dac7 xmlstream: add event_async() for events that need in-order processing
Essentially stream feature handlers which can then make sure the feature
has been process correctly (e.g. 0077).

This is the same approach as slixmpp!4.
2021-02-24 20:50:05 +01:00
mathieui
751987e2b0 xmlstream: remove loop parameter to wait_for
Deprecated in 3.8, removed in 3.10
2021-02-20 12:39:51 +01:00
mathieui
bbd351e9c1 global: rewrite copyright notice to use comments 2021-02-05 20:46:18 +01:00
mathieui
ccbba89cbd xmlstream: make dns_answers private 2021-02-04 19:22:13 +01:00
mathieui
d3063a0368 xmlstream: make connect_loop_wait private 2021-02-04 19:22:13 +01:00
mathieui
650e1a2ed5 docs/xmlstream: remove HTTP proxy references
It has been removed years ago.
2021-02-04 18:31:43 +01:00
mathieui
7932a03378 xmlstream: add a simple contextmanager for temporary events 2021-01-31 17:01:41 +01:00
mathieui
3f739e513b xmlstream: keep value of "end_session_on_disconnect"
That value should be set statically. Worst case is we fail to resume the
session.
2021-01-29 15:33:44 +01:00
mathieui
3642e2c7f4 xmlstream: ensure slow futures are scheduled on this loop 2021-01-29 15:33:44 +01:00
mathieui
f15311bda8 xmlstream: Make the reconnect handler a coroutine 2021-01-29 15:33:44 +01:00
mathieui
b2dfb4c1f3 xmlstream: do not touch connection state on abort()
leave it to the connection_lost handler
2021-01-29 15:33:44 +01:00
mathieui
d227579d56 xmlstream: set disconnected future on event 2021-01-29 15:33:44 +01:00
mathieui
571774edb4 xmlstream: end the parser when the stream has ended 2021-01-29 15:33:44 +01:00