Lua与Freebase API

我需要在 Lua 中使用Freebase API,但 Google 要求必须使用 SSL。

Lua 没有内置的网络支持,所以我必须使用像LuaSocket和'LuaSec`这样的外部库。问题是我无法安装它们。

我使用 ZeroBrane IDE,所以我尝试下载并将它们放在lualibs目录中,按照库的网站上的说明进行操作。但缺少ssl.coressl.context

我该在哪里找到它们?!

点赞
用户1442917
用户1442917

ssl.coressl.context似乎是在SSL动态库本身内部。如果您使用的是Windows,则只需将ssl.dll放入<ZeroBraneStudio> \bin\clibs\文件夹中(ssl.luassl\https.lua已经包含在lualibs文件夹下的ZBS安装中),您应该能够运行以下示例(我刚刚测试过):

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

我在这里发布了一个更复杂的示例,显示了配置和握手步骤:http://notebook.kulchenko.com/programming/https-ssl-calls-with-lua-and-luasec

2013-05-20 20:25:40