aboutsummaryrefslogtreecommitdiffstats
path: root/net/http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-11-09 15:59:32 +0100
committerKim Alvefur <zash@zash.se>2018-11-09 15:59:32 +0100
commitc500a82e4680e57d52df340ebc14e92faa0cbdde (patch)
tree695fe64c232d7d4348c96f309b263c45eaf9e85f /net/http.lua
parent88b509b8350eb652110fe5ebc1f2ff55c3f567a4 (diff)
downloadprosody-c500a82e4680e57d52df340ebc14e92faa0cbdde.tar.gz
prosody-c500a82e4680e57d52df340ebc14e92faa0cbdde.zip
net.http: Manually merge settings (fixes #1231)
Metatable table indexing is done raw, so metatables can't be chained
Diffstat (limited to 'net/http.lua')
-rw-r--r--net/http.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/http.lua b/net/http.lua
index b401b040..fe5250ac 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -24,7 +24,6 @@ local tonumber, tostring, traceback =
tonumber, tostring, debug.traceback;
local xpcall = require "util.xpcall".xpcall;
local error = error
-local setmetatable = setmetatable;
local log = require "util.logger".init("http");
@@ -273,7 +272,12 @@ local function new(options)
options = options;
request = request;
new = options and function (new_options)
- return new(setmetatable(new_options, { __index = options }));
+ local final_options = {};
+ for k, v in pairs(options) do final_options[k] = v; end
+ if new_options then
+ for k, v in pairs(new_options) do final_options[k] = v; end
+ end
+ return new(final_options);
end or new;
events = events.new();
};