# HG changeset patch # User Kim Alvefur # Date 1541775572 -3600 # Node ID 2700317f93e4ba3d8cb10e9aa4ee5b589a22927c # Parent 1dfcea523200447b0e8a4fa67cb83274ea06c763 net.http: Manually merge settings (fixes #1231) Metatable table indexing is done raw, so metatables can't be chained diff -r 1dfcea523200 -r 2700317f93e4 net/http.lua --- a/net/http.lua Wed Nov 07 20:30:21 2018 +0100 +++ b/net/http.lua Fri Nov 09 15:59:32 2018 +0100 @@ -24,7 +24,6 @@ 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 @@ 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(); };