mirror of
https://github.com/nodejs/node.git
synced 2025-05-11 05:20:25 +00:00

Fix running the tests when node was compiled without crypto
support. Some of these are cleanup after 52bae222a3
, where
common was used before it was required.
PR-URL: https://github.com/nodejs/node/pull/7056
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
33 lines
757 B
JavaScript
33 lines
757 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
|
|
const assert = require('assert');
|
|
const tls = require('tls');
|
|
|
|
if (!common.hasIPv6) {
|
|
common.skip('no IPv6 support');
|
|
return;
|
|
}
|
|
|
|
const ciphers = 'AECDH-NULL-SHA';
|
|
tls.createServer({ ciphers }, function() {
|
|
this.close();
|
|
}).listen(common.PORT, '::1', function() {
|
|
const options = {
|
|
host: 'localhost',
|
|
port: common.PORT,
|
|
family: 6,
|
|
ciphers: ciphers,
|
|
rejectUnauthorized: false,
|
|
};
|
|
// Will fail with ECONNREFUSED if the address family is not honored.
|
|
tls.connect(options).once('secureConnect', common.mustCall(function() {
|
|
assert.strictEqual('::1', this.remoteAddress);
|
|
this.destroy();
|
|
}));
|
|
});
|