# HG changeset patch # User Kim Alvefur # Date 1608326984 -3600 # Node ID 0f7ecc9a45609347d5f2fa74d18943cba05c96f6 # Parent 06a5919e249613039b92edad83ad1d99c0fb68bb 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. diff -r 06a5919e2496 -r 0f7ecc9a4560 plugins/mod_component.lua --- a/plugins/mod_component.lua Wed Dec 16 10:55:04 2020 +0100 +++ b/plugins/mod_component.lua Fri Dec 18 22:29:44 2020 +0100 @@ -193,6 +193,10 @@ 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;