问题
I am using restler, for making rest calls. I tested and got an expected response for the rest call to https://google.com. Now I am trying to make a call to another url location, but there is the following error message: SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message:openssl\ssl\s23_clnt.c:741:
I got the expected response using curl for the same url(url is different from here since I cannot share it. Sorry about that).
I also tried another rest client as in this link, but get the same error message.
Is it to do with the certificates of the sites, since the SSL version used in both the cases is SSLv3_method.
I am using the following code for making the rest call:
'use strict';
module.exports = function (app) {
app.get('/preference', function (req, res) {
res.render('preference', {});
});
var rest = require('restler');
rest.get('https://testlink/v1/path').on('complete', function(result) {
if (result instanceof Error) {
console.log('Error:', result.message);
} else {
console.log(result);
}
});
};
It will be of great help if some one can provide me with their valuable inputs. Thanks.
回答1:
I had the same problem, solved it by adding
secureProtocol: 'SSLv3_method'
to the restler.request at node_modules/restler/lib/restler.js line:82 as shown below:
this.request = proto.request({
host: this.url.hostname,
port: this.url.port,
path: this._fullPath(),
method: this.options.method,
headers: this.headers,
rejectUnauthorized: this.options.rejectUnauthorized,
secureProtocol: 'SSLv3_method' //<---- add this
});
来源:https://stackoverflow.com/questions/22467826/ssl-routinesssl23-get-server-hellosslv3-alert-unexpected-message