mod_proxy65: Return an error if no port is open (fixes #1240)
authorKim Alvefur <zash@zash.se>
Sun, 25 Nov 2018 13:14:05 +0100
changeset 9646 e31053344231
parent 9547 cbd3b9d4c60b
child 9647 bb8486491b48
mod_proxy65: Return an error if no port is open (fixes #1240)
plugins/mod_proxy65.lua
--- a/plugins/mod_proxy65.lua	Wed Oct 24 17:13:49 2018 +0200
+++ b/plugins/mod_proxy65.lua	Sun Nov 25 13:14:05 2018 +0100
@@ -121,6 +121,12 @@
 			return true;
 		end
 
+		if not proxy_port then
+			module:log("warn", "Not listening on any port");
+			origin.send(st.error_reply(stanza, "wait", "item-not-found", "Not listening on any port"));
+			return true;
+		end
+
 		local sid = stanza.tags[1].attr.sid;
 		origin.send(st.reply(stanza):tag("query", {xmlns="http://jabber.org/protocol/bytestreams", sid=sid})
 			:tag("streamhost", {jid=host, host=proxy_address, port=proxy_port}));