mod_bosh: Count connection attempts non-VirtualHost as "bad host" (stats)
authorKim Alvefur <zash@zash.se>
Sat, 03 Oct 2020 15:09:12 +0200
changeset 11130 cc6b1dab01a2
parent 11129 5bcddab1659b
child 11131 1d9cd1abc660
mod_bosh: Count connection attempts non-VirtualHost as "bad host" (stats)
plugins/mod_bosh.lua
--- a/plugins/mod_bosh.lua	Sat Oct 03 15:07:48 2020 +0200
+++ b/plugins/mod_bosh.lua	Sat Oct 03 15:09:12 2020 +0200
@@ -293,6 +293,7 @@
 
 		if not prosody.hosts[to_host] then
 			log("debug", "BOSH client tried to connect to non-existant host: %s", attr.to);
+			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));
@@ -301,6 +302,7 @@
 
 		if prosody.hosts[to_host].type ~= "local" then
 			log("debug", "BOSH client tried to connect to %s host: %s", prosody.hosts[to_host].type, attr.to);
+			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));