Implement a LuaSocket/LuaSec-based HTTP client

Note that LuaSec is actually optional, and will be loaded on-demand when the
first request using the https:// scheme is issued.
This commit is contained in:
Adrian Perez de Castro
2016-06-28 23:47:51 +03:00
parent 58ff794d92
commit daa8bfe923
2 changed files with 86 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ local get_http_factory = function (http_factory)
end
end
-- Try to import supplied HTTP client libraries, in order of preference.
local tries = http_factory and { http_factory } or { "chttp" }
local tries = http_factory and { http_factory } or { "chttp", "luasocket" }
local errors = {}
for i, http_factory in ipairs(tries) do
local ok, factory = pcall(require, "matrix.factory." .. http_factory)