Comparison

plugins/mod_bosh.lua @ 11126:cc6b1dab01a2

mod_bosh: Count connection attempts non-VirtualHost as "bad host" (stats)
author Kim Alvefur <zash@zash.se>
date Sat, 03 Oct 2020 15:09:12 +0200
parent 11125:5bcddab1659b
child 11391:8eff5c744395
comparison
equal deleted inserted replaced
11125:5bcddab1659b 11126:cc6b1dab01a2
291 return; 291 return;
292 end 292 end
293 293
294 if not prosody.hosts[to_host] then 294 if not prosody.hosts[to_host] then
295 log("debug", "BOSH client tried to connect to non-existant host: %s", attr.to); 295 log("debug", "BOSH client tried to connect to non-existant host: %s", attr.to);
296 report_bad_host();
296 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", 297 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
297 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); 298 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
298 response:send(tostring(close_reply)); 299 response:send(tostring(close_reply));
299 return; 300 return;
300 end 301 end
301 302
302 if prosody.hosts[to_host].type ~= "local" then 303 if prosody.hosts[to_host].type ~= "local" then
303 log("debug", "BOSH client tried to connect to %s host: %s", prosody.hosts[to_host].type, attr.to); 304 log("debug", "BOSH client tried to connect to %s host: %s", prosody.hosts[to_host].type, attr.to);
305 report_bad_host();
304 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", 306 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
305 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); 307 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
306 response:send(tostring(close_reply)); 308 response:send(tostring(close_reply));
307 return; 309 return;
308 end 310 end