mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
net.http.server: Expose way to set http server options
This commit is contained in:
parent
4fe3ec81e1
commit
47fe58f5ca
1 changed files with 8 additions and 1 deletions
|
@ -19,6 +19,7 @@ local sessions = {};
|
||||||
local listener = {};
|
local listener = {};
|
||||||
local hosts = {};
|
local hosts = {};
|
||||||
local default_host;
|
local default_host;
|
||||||
|
local options = {};
|
||||||
|
|
||||||
local function is_wildcard_event(event)
|
local function is_wildcard_event(event)
|
||||||
return event:sub(-2, -1) == "/*";
|
return event:sub(-2, -1) == "/*";
|
||||||
|
@ -130,7 +131,10 @@ function listener.onconnect(conn)
|
||||||
sessions[conn] = nil;
|
sessions[conn] = nil;
|
||||||
conn:close();
|
conn:close();
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
function listener.ondisconnect(conn)
|
function listener.ondisconnect(conn)
|
||||||
|
@ -300,6 +304,9 @@ end
|
||||||
function _M.fire_event(event, ...)
|
function _M.fire_event(event, ...)
|
||||||
return events.fire_event(event, ...);
|
return events.fire_event(event, ...);
|
||||||
end
|
end
|
||||||
|
function _M.set_option(name, value)
|
||||||
|
options[name] = value;
|
||||||
|
end
|
||||||
|
|
||||||
_M.listener = listener;
|
_M.listener = listener;
|
||||||
_M.codes = codes;
|
_M.codes = codes;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue