aboutsummaryrefslogtreecommitdiffstats
path: root/util/xmppstream.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-04-14 15:21:13 +0200
committerKim Alvefur <zash@zash.se>2021-04-14 15:21:13 +0200
commita4a008e046e060eb3d0d697b2a1445a62120d91d (patch)
tree2fb59979edbb978aa1c3f780864ee1e43c0ae9c4 /util/xmppstream.lua
parent19746da12f6193ace11f67afc0ba188121758150 (diff)
downloadprosody-a4a008e046e060eb3d0d697b2a1445a62120d91d.tar.gz
prosody-a4a008e046e060eb3d0d697b2a1445a62120d91d.zip
util.xmppstream: Send <?xml?> declaration in same call as stream open
If network_settings.opportunistic_writes is enabled then this would previously have resulted in two socket writes, and possibly two packets being sent. This caused some issues in older versions of Gajim, which apparently expected the stream opening in the first packet, and thus it could not connect. With this change and opportunistic_writes enabled, the first packet should contain both the xml declaration and the stream open tag. Without opportunistic_writes, there should be no observable change. Tested with Gajim 1.1.2 (on same machine). Unsure if loopback behaves differently than the network here.
Diffstat (limited to 'util/xmppstream.lua')
-rw-r--r--util/xmppstream.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua
index bab0f253..2763b000 100644
--- a/util/xmppstream.lua
+++ b/util/xmppstream.lua
@@ -268,8 +268,7 @@ local function new(session, stream_callbacks, stanza_size_limit)
if session.stream_attrs then
session:stream_attrs(from, to, attr)
end
- send("<?xml version='1.0'?>");
- send(st.stanza("stream:stream", attr):top_tag());
+ send("<?xml version='1.0'?>"..st.stanza("stream:stream", attr):top_tag());
return true;
end