luvit / lit

Toolkit for developing, sharing, and running luvit/lua programs and libraries.
http://lit.luvit.io/
Apache License 2.0
245 stars 58 forks source link

coro-http: Error verifying peer: unable to get local issuer certificate #242

Open Uppernate opened 6 years ago

Uppernate commented 6 years ago

So a site that I HTTP GET information from has updated their SSL certificates because of a "Chrome distrust" issue. Now I get the error that is in the title and an immediate crash for "cannot resume dead coroutine"

Full error log:

command:verify Error: D:/Discord Bots/ClickBot/deps/coro-http.lua:74: Error verifying peer: unable to get local issuer certificate Uncaught Error: D:/Discord Bots/ClickBot/deps/secure-socket/biowrap.lua:56: cannot resume dead coroutine stack traceback: [C]: in function 'handshakeComplete' D:/Discord Bots/ClickBot/deps/secure-socket/biowrap.lua:56: in function <D:/Discord Bots/ClickBot/deps/secure-socket/biowrap.lua:49> [C]: in function 'run'

[C]: in function 'xpcall' [string "bundle:init.lua"]:47: in function 'fn'

Code snippet, fairly simple GET request:

local http = require("coro-http") ... function verify(...) local full = "this is where the url would be made with user's parameters" local request, data = http.request("GET", full) end

Site in question is https://community.clickteam.com/forum.php

Bilal2453 commented 3 years ago

This is pretty late sorry for that, but if you are still interested here it is:

As you might have knew, coro-http is suppose to be called inside a coroutine (hence the coro in the name), since it WILL try to yield in specific cases.

Therefor your code should've been looked something like

local http = require("coro-http")

coroutine.wrap(function()
  local request, data = http.request("GET", url)
end)()

or something along these lines. You could read more about coroutines for more information about that.

If you are no longer interested or this solves your issue you could close this 😄