diff options
author | Kim Alvefur <zash@zash.se> | 2020-12-18 22:29:44 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-12-18 22:29:44 +0100 |
commit | 27a97b963d8aed1eb719c89b5352f00a28f411ea (patch) | |
tree | af19e9c98af794a38c11c0d7ba0b84b5a8703b17 /plugins | |
parent | ec2e732fea302e6072a4a4df559741736a9174ae (diff) | |
download | prosody-27a97b963d8aed1eb719c89b5352f00a28f411ea.tar.gz prosody-27a97b963d8aed1eb719c89b5352f00a28f411ea.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.lua | 4 |
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; |