mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
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.
This commit is contained in:
parent
ec2e732fea
commit
27a97b963d
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue