A non-blocking https client library for lua, it also support http request
- openssl >= 1.0.1
- lua >= 5.3
httpsc = require "httpsc"local host = "www.baidu.com"
local port = 443
fd = httpsc.connect(host, port) -- default https
-- fd = httpsc.connect(host, port, "http")
-- fd = httpsc.connect(host, port, "https")it can also check whether connection is alive for connection reuse
-- Check connection
while true do
local ok = httpsc.check_connect(fd)
if ok then break end
httpsc.usleep(10000)
endhttpsc.send(fd, msg)httpsc.recv(fd, size) -- size is optionalset_ip is not necessary, but it is suggested
httpsc.set_ip(domain, ip)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