From 77acd92c626a13dbd67dc6850e7233bd67b1a69d Mon Sep 17 00:00:00 2001 From: pep Date: Wed, 19 Nov 2025 12:41:43 +0100 Subject: [PATCH] tokio-xmpp: Ignore missing "version" stream attribute for 0114 components From the prosody@ room: - 0114 doesn't mention the removal of @version on the stream, and it refers to 3920 which has it as a MUST. - 0114 streams have historically never used @version="1.0" - @version="1.0" implies stream features which 0114 doesn't have. - There was a proposal years ago to fix this but a new XEP was preferred (0225). The change here uses a compile-time check, and may have to change when support for 0225 arrives if it's still gated behind the "component" feature (even though it may be weird to have both under the same feature). We'll see when we get there. Signed-off-by: pep --- tokio-xmpp/ChangeLog | 2 ++ tokio-xmpp/src/xmlstream/common.rs | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tokio-xmpp/ChangeLog b/tokio-xmpp/ChangeLog index 56481b5b..44ed8fef 100644 --- a/tokio-xmpp/ChangeLog +++ b/tokio-xmpp/ChangeLog @@ -1,5 +1,7 @@ Version NEXT: 0000-00-00 RELEASER + * Fixed: + - Ignore missing "version" stream attribute for 0114 components. Version 5.0.0: 2025-10-28 pep diff --git a/tokio-xmpp/src/xmlstream/common.rs b/tokio-xmpp/src/xmlstream/common.rs index 1509a368..ca3eb358 100644 --- a/tokio-xmpp/src/xmlstream/common.rs +++ b/tokio-xmpp/src/xmlstream/common.rs @@ -876,10 +876,12 @@ impl StreamHeader<'static> { } } None => { - return Err(io::Error::new( - io::ErrorKind::InvalidData, - "required `version` attribute missing", - )) + if cfg!(not(feature = "component")) { + return Err(io::Error::new( + io::ErrorKind::InvalidData, + "required `version` attribute missing", + )); + } } }