aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-12-18 22:29:44 +0100
committerKim Alvefur <zash@zash.se>2020-12-18 22:29:44 +0100
commita649af9e027b2f36f7d6c288586a5a86c01499ee (patch)
treeaf19e9c98af794a38c11c0d7ba0b84b5a8703b17 /plugins
parent214a20ac22c280d70314faffb4d10725574459b8 (diff)
downloadprosody-a649af9e027b2f36f7d6c288586a5a86c01499ee.tar.gz
prosody-a649af9e027b2f36f7d6c288586a5a86c01499ee.zip
mod_component: Distinguish missing stream @to from unknown local component (thanks Daniel_W)
Spectrum2 did not include a stream @to attribute due to a configuration error. "nil does not match ..." is not very clear in pointing this out and is somewhat confusing, tho it did help pinpoint what went wrong. It's also not great leak to programming language internals like "nil" out into user-facing strings like this.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_component.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index d06df71c..a0bac298 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -193,6 +193,10 @@ function stream_callbacks.error(session, error, data)
end
function stream_callbacks.streamopened(session, attr)
+ if not attr.to then
+ session:close{ condition = "improper-addressing", text = "A 'to' attribute is required on stream headers" };
+ return;
+ end
if not hosts[attr.to] or not hosts[attr.to].modules.component then
session:close{ condition = "host-unknown", text = tostring(attr.to).." does not match any configured external components" };
return;