A non-blocking https client library for lua, it also support blocking request, http request
httpsc = require "httpsc"
local ip = "127.0.0.1"
local port = 443
fd = httpsc.connect(ip, port)
-- fd = httpsc.connect(ip, port, "http")
-- fd = httpsc.connect(ip, port, "https")
-- Check connection
while true do
local ok = httpsc.check_connect(fd)
if ok then break end
httpsc.usleep(10000)
end
httpsc.send(fd, msg)
httpsc.recv(fd, size) -- size is optional
httpsc.set_conf({
init_lib = true, -- load openssl libary, default: true
async = true, -- work under non-blocking, default: true
send_timeout = 10000, -- socket send timeout, default: 10000 (10 second)
recv_timeout = 10000, -- socket recv timeout, default: 10000 (10 second)
})
See test.lua