我有一个安装了NodeMCU
固件的固件(模块:http
,tls
等)的ESP12。HTTPS数据检索错误
每当我尝试使用使用https连接,我收到以下错误:
> http.get("https://pastebin.com/raw/cAB83eF1", nil, function(code, data)
>> if (code < 0) then
>> print("HTTP request failed")
>> else
>> print(code, data)
>> end
>> end)
> HTTP client: Disconnected with error: -114
HTTP client: Connection timeout
HTTP client: Connection timeout
在那里,当我尝试没有HTTPS相同pastebin.com
链接,我能够接收数据和HTTP状态码。
> http.get("http://pastebin.com/raw/cAB83eF1", nil, function(code, data)
>> if (code < 0) then
>> print("HTTP request failed")
>> else
>> print(code, data)
>> end
>> end)
> 200 test
从docs of http.get报价:
Each request method takes a callback which is invoked when the response has been received from the server. The first argument is the status code, which is either a regular HTTP status code, or -1 to denote a DNS, connection or out-of-memory failure, or a timeout (currently at 10 seconds).
由于文档说有效的代码是-1和HTTP代码,我怎么能找出什么是-114?
EDIT1:建设有调试选项上的固件之后。我得到以下错误:
> http.get("https://pastebin.com/raw/cAB83eF1", nil, function(code, data)
>> if (code < 0) then
>> print("HTTP request failed")
>> else
>> print(code, data)
>> end
>> end)
> client handshake start.
please start sntp first !
please start sntp first !
client handshake failed!
Reason:[-0x7200]
HTTP client: Disconnected with error: -114
HTTP client: Connection timeout
HTTP client: Connection timeout
=rtctime.get()
1501394767 272709
>
按日志声明Reason:[-0x7200]
0x72十六进制为-114十进制这被后来Disconnected with error: -114
打印。
另外sntp.sync()
随着从rtctime.get()
输出处看到已经被执行。即使SNTP已同步,为什么打印消息please start sntp first !
?
而且后来在日志中,在-114消息后,它显示Connection timeout
消息。我如何更改https连接的超时时间?任何指向C /头文件的指针?
注:我已经安装了Linux机器上建立固件的git仓库和码头工人的形象。
PS:我需要HTTPS,因为我会做我的ESP12与托管在云中的RESP API通信。
图像是否有卷曲设置?你可以试试看看'curl -v https:// pastebin.com/raw/cAB83eF1'给你什么? –
我发现很多与HTTPS失败有关的开放问题。尝试在get命令之前将其添加到代码tls.cert.verify(false)。 https://github.com/nodemcu/nodemcu-firmware/issues/1915 –
@TarunLalwani还是同样的错误 – ritesht93