2

I need to use the Freebase API in Lua, but Google requires you to use SSL.

Lua doesn't have built-in networking support, so I have to use external stuff like LuaSocket and 'LuaSec`. The problem is that I can't install them.

I use the ZeroBrane IDE, so I tried downloading and putting them in the lualibs directory, following the instructions on the libs' websites. But ssl.core and ssl.context are missing.

Where can I find them?!

Borodin
  • 126,100
  • 9
  • 70
  • 144
Alexander
  • 25
  • 5

1 Answers1

4

ssl.core and ssl.context seem to be inside the SSL dynamic library itself. If you are on Windows, all you need to do is to put ssl.dll in <ZeroBraneStudio>\bin\clibs\ folder (ssl.lua and ssl\https.lua are already included in ZBS install under lualibs folder) and you should be able to run the following example (I just tested it):

require("socket")
local https = require("ssl.https")
local body, code, headers, status = https.request("https://www.google.com")
print(status)

I posted a more complex example that shows configuration and handshake steps here: http://notebook.kulchenko.com/programming/https-ssl-calls-with-lua-and-luasec.

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56
  • Thanks! I actually found Your post in many of the hundreds of Google searches I've made.. I feel like a complete idiot, but where does that DLL has to be? I can't find it in LuaSocket 2.0.1 nor in LuaSec – Alexander May 20 '13 at 20:54
  • It used to be referenced on LuaSec wiki, but after it's reorganized, I don't see the link anymore. You can grab it from one of earlier versions of ZBS: https://github.com/pkulchenko/ZeroBraneStudio/archive/0.35.zip (bin/clibs/ssl.dll). – Paul Kulchenko May 20 '13 at 20:59
  • Thank You sooo much! I'd up-vote You, but got no reputation to do it. Thanks again. – Alexander May 20 '13 at 21:02
  • 1
    @Alexander You can accept this as the answer though. – greatwolf May 20 '13 at 21:51