diff mod_firewall/mod_firewall.lua @ 2130:9239893a2400

mod_firewall: Don't use util.cache unless it's needed, and add explanatory error if it is not available
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 Mar 2016 09:57:09 +0000
parents 21bc4d7cddae
children 6848297cf40a
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Fri Mar 18 09:51:01 2016 +0000
+++ b/mod_firewall/mod_firewall.lua	Fri Mar 18 09:57:09 2016 +0000
@@ -117,6 +117,7 @@
 	};
 	multithrottle = {
 		global_code = function (throttle)
+			assert(pcall(require, "util.cache"), "Using LIMIT with 'on' requires Prosody 0.10 or higher");
 			assert(idsafe(throttle), "Invalid rate limit name: "..throttle);
 			assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle);
 			return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle);