nodejs中的SSL错误 [英] SSL Error in nodejs

查看:99
本文介绍了nodejs中的SSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过节点 https.request() 获取网页.这样做会导致我的代码记录错误.使用节点请求模块也有同样的结果:

I'm trying to get a webpage via node https.request(). Doing so results in an error getting logged by my code. Using the node request module has the same result:

请求问题:140398870042432:错误:140773F2:SSL 例程:SSL23_GET_SERVER_HELLO:sslv3 警报意外消息:s23_clnt.c:658:

以下表明使用了错误的 SSL 版本,但我找不到更改版本的方法:卷曲错误:sslv3 警报意外消息".从我的终端使用 curl 会返回一个响应,就像在我的浏览器中点击 URL(它是一个登录页面)一样.我的代码如下.

The following indicates the wrong SSL version is being used, but I cannot find a way to change the version: curl error: "sslv3 alert unexpected message". Using curl from my terminal returns a response as does hitting the URL in my browser (it is a login page). My code is below.

var request = require('request')
request.get("https://icmserver.wit.ie/balance", function(err, res, body) {
    if (err) {
        return console.log(err)
    }
    return body;
});

有人知道这里会发生什么吗?

Does anyone have any idea what might be happening here?

推荐答案

尝试在您提出的请求中使用 options = { secureProtocol: 'SSLv3_method' }.

Try to use options = { secureProtocol: 'SSLv3_method' } in the request you are making.

这篇关于nodejs中的SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆