diff options
author | Kim Alvefur <zash@zash.se> | 2016-08-18 14:50:39 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-08-18 14:50:39 +0200 |
commit | c7c1e0eca23d2a65dab01513b74b39754a8cd0c9 (patch) | |
tree | 22cb5449116bb8eb65f2aa7eb98e9b2c808734ae | |
parent | aa01a982522b23782e20f613da995c42192f24e6 (diff) | |
download | prosody-c7c1e0eca23d2a65dab01513b74b39754a8cd0c9.tar.gz prosody-c7c1e0eca23d2a65dab01513b74b39754a8cd0c9.zip |
net.http.server: Expose way to set http server options
-rw-r--r-- | net/http/server.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua index f091595c..32cda8aa 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -19,6 +19,7 @@ local sessions = {}; local listener = {}; local hosts = {}; local default_host; +local options = {}; local function is_wildcard_event(event) return event:sub(-2, -1) == "/*"; @@ -130,7 +131,10 @@ function listener.onconnect(conn) sessions[conn] = nil; conn:close(); end - sessions[conn] = parser_new(success_cb, error_cb); + local function options_cb() + return options; + end + sessions[conn] = parser_new(success_cb, error_cb, "server", options_cb); end function listener.ondisconnect(conn) @@ -300,6 +304,9 @@ end function _M.fire_event(event, ...) return events.fire_event(event, ...); end +function _M.set_option(name, value) + options[name] = value; +end _M.listener = listener; _M.codes = codes; |