# HG changeset patch # User Kim Alvefur # Date 1601729951 -7200 # Node ID 0f4260f99ea203037da25749ce5b354a2c7bb6db # Parent 68df52bf08d5229e179f0aa3508ea0fd6457f6ac mod_bosh: Pick out the 'wait' before checking it instead of earlier Going to add more host related checks, so to keep the wait variable closer to the related checks diff -r 68df52bf08d5 -r 0f4260f99ea2 plugins/mod_bosh.lua --- a/plugins/mod_bosh.lua Thu Oct 01 15:08:58 2020 +0100 +++ b/plugins/mod_bosh.lua Sat Oct 03 14:59:11 2020 +0200 @@ -269,7 +269,6 @@ context.notopen = nil; -- Signals that we accept this opening tag local to_host = nameprep(attr.to); - local wait = tonumber(attr.wait); if not to_host then log("debug", "BOSH client tried to connect to invalid host: %s", tostring(attr.to)); local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", @@ -277,6 +276,8 @@ response:send(tostring(close_reply)); return; end + + local wait = tonumber(attr.wait); if not rid or (not attr.wait or not wait or wait < 0 or wait % 1 ~= 0) then log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", tostring(attr.rid), tostring(attr.wait)); local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",