aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-07-20 17:22:21 -0400
committerMatthew Wild <mwild1@gmail.com>2011-07-20 17:22:21 -0400
commitd4b99e90cf89386aa2d1cf4679074790f9d7101c (patch)
treede8473089f094242501e5fb41e28dbeb70446e17
parentb5efdaa68e730043fcfdbc8041dd83e9487d6c2a (diff)
downloadprosody-d4b99e90cf89386aa2d1cf4679074790f9d7101c.tar.gz
prosody-d4b99e90cf89386aa2d1cf4679074790f9d7101c.zip
mod_bosh: Update to use typed variants of module:get_option(), makes it more tolerant to config variations and simplifies the code.
-rw-r--r--plugins/mod_bosh.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index 6550a44a..e6596b41 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -29,16 +29,16 @@ local xmlns_bosh = "http://jabber.org/protocol/httpbind"; -- (hard-coded into a
local stream_callbacks = {
stream_ns = xmlns_bosh, stream_tag = "body", default_ns = "jabber:client" };
-local BOSH_DEFAULT_HOLD = tonumber(module:get_option("bosh_default_hold")) or 1;
-local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60;
-local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5;
-local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2;
+local BOSH_DEFAULT_HOLD = module:get_option_number("bosh_default_hold", 1);
+local BOSH_DEFAULT_INACTIVITY = module:get_option_number("bosh_max_inactivity", 60);
+local BOSH_DEFAULT_POLLING = module:get_option_number("bosh_max_polling", 5);
+local BOSH_DEFAULT_REQUESTS = module:get_option_number("bosh_max_requests", 2);
local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure");
local default_headers = { ["Content-Type"] = "text/xml; charset=utf-8" };
-local cross_domain = module:get_option("cross_domain_bosh");
+local cross_domain = module:get_option("cross_domain_bosh", false);
if cross_domain then
default_headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS";
default_headers["Access-Control-Allow-Headers"] = "Content-Type";
@@ -426,7 +426,7 @@ end
local function setup()
- local ports = module:get_option("bosh_ports") or { 5280 };
+ local ports = module:get_option_array("bosh_ports") or { 5280 };
httpserver.new_from_config(ports, handle_request, { base = "http-bind" });
timer.add_task(1, on_timer);
end