我正在尝试在一个小 lua 脚本中使用curl 库。
我知道有一个“-k”选项可以禁用curl默认执行的认证验证......但我一直无法找到如何通过代码来做到这一点。
到目前为止,这是我所拥有的:
local cURL = require("cURL")
headers = {"Accept: text/*",
"Accept-Language: en",
"Accept-Charset: iso-8859-1,*,utf-8",
"Cache-Control: no-cache"}
login_url = "https://10.10.2.1/cgi-bin/acd/myapp/controller/method?userid=tester&password=123123"
c = cURL.easy_init()
c:setopt_url(login_url)
c:perform({writefunction=function(str)
succeed = succeed or (string.find(str, "srcId:%s+SignInAlertSupressor--"))
end })
谢谢你的时间。
使用新版本的 Lua-cURL[1] 你可以写
local cURL = require("cURL")
headers = {
"Accept: text/*",
"Accept-Language: en",
"Accept-Charset: iso-8859-1,*,utf-8",
"Cache-Control: no-cache"
}
login_url = "https://10.10.2.1/cgi-bin/acd/myapp/controller/method?userid=tester&password=123123"
c = cURL.easy{
url = login_url,
ssl_verifypeer = false,
ssl_verifyhost = false,
httpheader = headers,
writefunction = function(str)
succeed = succeed or (string.find(str, "srcId:%s+SignInAlertSupressor--"))
end
}
c:perform()
1 - https://github.com/Lua-cURL/Lua-cURLv3 https://github.com/Lua-cURL/Lua-cURLv3
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)