kernelsauce / turbo

Turbo is a framework built for LuaJIT 2 to simplify the task of building fast and scalable network applications. It uses a event-driven, non-blocking, no thread design to deliver excellent performance and minimal footprint to high-load applications while also providing excellent support for embedded uses.
http://turbo.readthedocs.io/
Apache License 2.0
525 stars 84 forks source link

async client is not working with ssl options #342

Closed reddevilM closed 5 years ago

reddevilM commented 5 years ago

Getting below error.

[E 2019/02/26 18:04:17] [async.lua] Error code -11. Could not create SSL context. error:02001002:system library:fopen:No such file or directory Could not get URL: Could not create SSL context. error:02001002:system library:fopen:No such file or directory

modified the example curl.lua to use ssl_options

TURBO_SSL = true -- Enable SSL local turbo = require "turbo" turbo.log.categories.success = false

local url = arg[1] -- First arg should be URL.

local tio = turbo.ioloop.instance()

tio:add_callback(function() -- Must place everything in a IOLoop callback. local client = turbo.async.HTTPClient({ ssl_options = { priv_file = "./sslkeys/clientPrivateKey.pem", cert_file = "./sslkeys/odclient.crt", ca_path = "./sslkeys/ottrootca.crt", verify_ca = false }})

local res = coroutine.yield(
    client:fetch(url,
        {allow_redirects=true, connect_timeout=5}))
if res.error or res.headers:get_status_code() ~= 200 then
    -- Check for errors.
    print("Could not get URL:", res.error.message)
else
    -- Print result to stdout.
    io.write(res.body)
end
tio:close()

end)

tio:start()

reddevilM commented 5 years ago

tried using curl.lua in the example folder.

I am getting below error

[root@ecmngr117 examples]# luajit curl.lua https://www.google.com [E 2019/03/11 19:27:36] [async.lua] Error code -11. Could not create SSL context. error:02001002:system library:fopen:No such file or directory Could not get URL: Could not create SSL context. error:02001002:system library:fopen:No such file or directory