概述
OTA上传场景,脚本需要使用curl请求服务器的一个接口传递信息.但是在源码服务器上一直卡在请求阶段,本地机器却可以请求成功.
分析解决
背景信息
主机IP信息:
OTA服务器IP地址:x.x.x.1
源码服务器地址:x.x.x.2
本地地址:x.x.y.1
请求:
curl -d "xxxx" https://niot.com:8091/api/edition/firmwareedition_add
源码服务器请求
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- 0:00:25 --:–:-- 0
一直卡在请求,没有响应;但是本地机器请求是成功.
使用wget尝试
本地尝试成功:
正在解析主机 niot.com (niot.com)... x.x.x.1
正在连接 niot.com (niot.com)|x.x.x.1|:8091... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 45 [application/json]
正在保存至: “firmwareedition_add.1”
firmwareedition_add.1 100%[======================