# HG changeset patch # User Kim Alvefur # Date 1572704953 -3600 # Node ID 4c36bc28b99e79473d1bb62a469a89281f622794 # Parent b337df192a10fa364157443f70ffcca443c5af77 mod_bosh: Abort early if request is missing hostname Prevents traceback from passing nil to nameprep() diff -r b337df192a10 -r 4c36bc28b99e plugins/mod_bosh.lua --- 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