mirror of https://github.com/lukechilds/node.git
Browse Source
Respect the `{ family: 6 }` address family property when connecting to a remote peer over TLS. Fixes: https://github.com/nodejs/node/issues/4139 Fixes: https://github.com/nodejs/node/issues/6440 PR-URL: https://github.com/nodejs/node/pull/6654 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>v6.x
Ben Noordhuis
9 years ago
committed by
Rod Vagg
6 changed files with 74 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||
'use strict'; |
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const https = require('https'); |
|||
|
|||
if (!common.hasIPv6) { |
|||
common.skip('no IPv6 support'); |
|||
return; |
|||
} |
|||
|
|||
const ciphers = 'AECDH-NULL-SHA'; |
|||
https.createServer({ ciphers }, function(req, res) { |
|||
this.close(); |
|||
res.end(); |
|||
}).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.
|
|||
https.get(options, common.mustCall(function() { |
|||
assert.strictEqual('::1', this.socket.remoteAddress); |
|||
this.destroy(); |
|||
})); |
|||
}); |
@ -0,0 +1,27 @@ |
|||
'use strict'; |
|||
const common = require('../common'); |
|||
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(); |
|||
})); |
|||
}); |
Loading…
Reference in new issue