From 51c8eda815a352fa7044c016a0461e233ab209d5 Mon Sep 17 00:00:00 2001 From: Adrian Perez de Castro Date: Mon, 4 Jul 2016 18:23:35 +0300 Subject: [PATCH] Fix conversion of http.headers in Lua 5.1 and LuaJIT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The __pairs metamethod was introduced in 5.2, so instead of using pairs() on http.headers values, use its :each() method — which is what the __pairs metamethod calls anyway. --- matrix/httpclient/chttp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix/httpclient/chttp.lua b/matrix/httpclient/chttp.lua index 0f01ac9..31d2a6c 100644 --- a/matrix/httpclient/chttp.lua +++ b/matrix/httpclient/chttp.lua @@ -23,7 +23,7 @@ end local function headers_to_dict(h) local headers = {} - for name, value in pairs(h) do + for name, value in h:each() do if name:sub(1, 1) ~= ":" then headers[name] = value end