aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/server.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-18 17:36:46 +0200
committerKim Alvefur <zash@zash.se>2016-08-18 17:36:46 +0200
commit5ce8cd7c944d2e59621a79fb0fdc51a49f42af5e (patch)
treea89e877c6e83d9aa3b79825812361591bf12bf2e /net/http/server.lua
parent2d2c10e83b62fbe72ac90043eca1c90d60a8cee5 (diff)
parent33a8994b3cf6aabe428b7cdf6bba7bdf68d9c366 (diff)
downloadprosody-5ce8cd7c944d2e59621a79fb0fdc51a49f42af5e.tar.gz
prosody-5ce8cd7c944d2e59621a79fb0fdc51a49f42af5e.zip
Merge 0.10->trunk
Diffstat (limited to 'net/http/server.lua')
-rw-r--r--net/http/server.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index ba45ede0..8aa28f5c 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -22,6 +22,7 @@ local incomplete = {};
local listener = {};
local hosts = {};
local default_host;
+local options = {};
local function is_wildcard_event(event)
return event:sub(-2, -1) == "/*";
@@ -31,7 +32,7 @@ local function is_wildcard_match(wildcard_event, event)
end
local _handlers = events._handlers;
-local recent_wildcard_events = cache.new(10000, function (key, value)
+local recent_wildcard_events = cache.new(10000, function (key, value) -- luacheck: ignore 212/value
rawset(_handlers, key, nil);
end);
@@ -133,7 +134,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)
@@ -170,7 +174,7 @@ local headerfix = setmetatable({}, {
end
});
-function _M.hijack_response(response, listener)
+function _M.hijack_response(response, listener) -- luacheck: ignore
error("TODO");
end
function handle_request(conn, request, finish_cb)
@@ -350,6 +354,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;