我正在尝试从node.js调用https web服务。由于我在代理后面,因此我在选项中提供代理和端口以及凭据。但是我遇到了以下错误:
[Error: 2060:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol :openssl\ssl\s23_clnt.c:683: ]
以下是我尝试调用https web服务的代码片段:
[Error: 2060:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol :openssl\ssl\s23_clnt.c:683: ]
以下是我尝试调用https web服务的代码片段:
var https = require('https');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
var data = '';
var options = {
hostname: 'proxy',
port: 8080,
path: 'https://crm.zoho.com/crm/private/json/Leads/getMyRecords?authtoken=11111tsvs26677026bcba45ae3f&scope=crmapi',
headers: {
"Proxy-Authorization" : auth
}
};
console.log("options- " + JSON.stringify(options) + '\n');
var req = https.request(options, function(res) {
console.log("statusCode- " + res.statusCode);
console.log("headers-" + res.headers);
res.on('data', function(chunk) {
data += chunk;
});
res.on('end', function (chunk) {
console.log('response-' + data);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});
有人能帮我解决这个问题吗?
提前感谢, Manoj