Fix conversion of http.headers in Lua 5.1 and LuaJIT

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.
This commit is contained in:
Adrian Perez de Castro
2016-07-04 18:23:35 +03:00
parent 0aa232965c
commit 51c8eda815

View File

@@ -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