Software /
code /
prosody
Changeset
10377:4c36bc28b99e
mod_bosh: Abort early if request is missing hostname
Prevents traceback from passing nil to nameprep()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Nov 2019 15:29:13 +0100 |
parents | 10376:b337df192a10 |
children | 10378:04c4750ff8d2 |
files | plugins/mod_bosh.lua |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_bosh.lua Sat Nov 02 15:27:53 2019 +0100 +++ b/plugins/mod_bosh.lua Sat Nov 02 15:29:13 2019 +0100 @@ -272,6 +272,15 @@ -- New session request context.notopen = nil; -- Signals that we accept this opening tag + if not attr.to then + log("debug", "BOSH client tried to connect without specifying a host"); + report_bad_host(); + local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", + ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); + response:send(tostring(close_reply)); + return; + end + local to_host = nameprep(attr.to); local wait = tonumber(attr.wait); if not to_host then