繁体   English   中英

使用请求api(node.js)时发生未知协议错误

[英]Unknown protocol error while using request api ( node.js )

这是我的代码。 我正在运行0.10.24版本。 有人可以调查一下吗? 显示错误“错误:6304:错误:140770FC:SSL例程:SSL23_GET_SERVER_HELLO:未知协议:openssl \\ ssl \\ s23_clnt.c:766:”。

var url = require('url'),
    request = require('request'),
    loginLink = "https://foo";

var params = {
    maxRedirects: 10,
    followRedirect: true,
    followAllRedirects: true,
    timeout: 10000,
    url: url.parse(loginLink),
    method: "POST",
    jar: true,
    strictSSL: false,
    form: {
        'userid': 'userid',
        'pwd': 'pass',
        'timezoneOffset': -330  
    },
    headers: {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1753.0 Safari/537.36',
        'Connection': 'keep-alive',
        'Origin': 'https://foo'
    }
}

request(params,function(error,response,body){
    if(!error && response.statusCode == 200){
        console.log(body);
    }else{
        console.log(response);
        console.log(error);
    }
});

更改SSL版本(?)

options = {
    ....
    strictSSL: false,
    secureProtocol: 'SSLv3_client_method',
    ....
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM