CNode

有人做过node https发送post请求?错误提示unknown protocol:openssl\ssl\s23_clnt.c:766:

Aadam1985发布于12 年前最后回复12 年前2 回复15783 浏览0 收藏

D:\node\weishi>node post problem with request: 8820:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:un known protocol:openssl\ssl\s23_clnt.c:766:

代码 var https = require('https'); var options = { hostname: 'open.t.qq.com', port: 80, path: '/api/auth/token', method: 'POST' }; var req = https.request(options, function (response) { var str = ''; response.on('data', function (data) { str = str + data; }); response.on('end', function () { console.log(str); }); }); req.on('error', function (e) { console.log('problem with request: ' + e.message); }); //req.write(""); req.end();

查看回复

回复 (2)

L
leapon#1·12 年前

https 默认端口是 443,你的 options 里用的是 80 端口,可能是这个?

参与回复
登录后即可参与回复。登录