Software /
code /
prosody
Changeset
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 (2016-08-18) |
parents | 7578:65bf55fdf971 |
children | 7580:588ed6451984 |
files | net/http/server.lua |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
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;