我在用NodeMCU做HTTPS GET请求时遇到了问题,尽管根据他们在StackOverflow上的文档和this answer,这似乎是可能的。
我尝试的代码是:
function getHTTPS()
http.get('https://httpbin.org/get', nil, function(code, data)
print(code, data)
end)
end
enduser_setup.start(
function()
print("Connected to wifi as: " .. wifi.sta.getip())
getHTTPS()
end,
function(err, str)
print("enduser_setup: Err #" .. err .. ": " .. str)
end
);
这就得到了结果:-1 nil
。如果我将URL从https://httpbin.org/get
改为http://httpbin.org/get
,我会得到预期的结果200 <RESPONSE>
。
我的NodeMCU版本是:
NodeMCU custom build by frightanic.com
branch: master
commit: 95e85c74e7310a595aa6bd57dbbc69ec3516e9c6
SSL: true
modules: cjson,enduser_setup,file,gpio,http,mdns,net,node,tmr,uart,wifi build
built on: 2016-08-27 07:36
powered by Lua 5.1.4 on SDK 1.5.4.1(39cb9a32)
我做错了什么?
发布于 2016-08-28 21:20:22
你没做错什么。如果您使用启用了DEBUG的固件执行此操作,您将看到SSL握手失败。
Espressif SDK附带的SSL库只支持4 cipher suites。它们都不在httpbin.org使用的SSL证书支持的密码列表中。
https://stackoverflow.com/questions/39189745
复制相似问题