Software /
code /
prosody
Diff
net/http/server.lua @ 7579:d430573fe9f8
net.http.server: Expose way to set http server options
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 Aug 2016 14:50:39 +0200 |
parent | 6589:015f2b4e2f9a |
child | 7581:01d0d466d7be |
line wrap: on
line diff
--- a/net/http/server.lua Thu Aug 18 14:50:06 2016 +0200 +++ b/net/http/server.lua Thu Aug 18 14:50:39 2016 +0200 @@ -19,6 +19,7 @@ local listener = {}; local hosts = {}; local default_host; +local options = {}; local function is_wildcard_event(event) return event:sub(-2, -1) == "/*"; @@ -130,7 +131,10 @@ 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 @@ 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;