| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 271927f commit c807287
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,6 +102,11 @@ Agent.prototype.getName = function(options) { | |||
| 102 | 102 | if (options.localAddress) | |
| 103 | 103 | name += options.localAddress; | |
| 104 | 104 | ||
| 105 | + // Pacify parallel/test-http-agent-getname by only appending | ||
| 106 | + // the ':' when options.family is set. | ||
| 107 | + if (options.family === 4 || options.family === 6) | ||
| 108 | + name += ':' + options.family; | ||
| 109 | + | ||
| 105 | 110 | return name; | |
| 106 | 111 | }; | |
| 107 | 112 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -994,6 +994,7 @@ exports.connect = function(/* [port, host], options, cb */) { | |||
| 994 | 994 | connect_opt = { | |
| 995 | 995 | port: options.port, | |
| 996 | 996 | host: options.host, | |
| 997 | + family: options.family, | ||
| 997 | 998 | localAddress: options.localAddress | |
| 998 | 999 | }; | |
| 999 | 1000 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,13 @@ test-tick-processor : PASS,FLAKY | |||
| 12 | 12 | [$system==linux] | |
| 13 | 13 | test-tick-processor : PASS,FLAKY | |
| 14 | 14 | ||
| 15 | + # Flaky until https://github.com/nodejs/build/issues/415 is resolved. | ||
| 16 | + # On some of the buildbots, AAAA queries for localhost don't resolve | ||
| 17 | + # to an address and neither do any of the alternatives from the | ||
| 18 | + # localIPv6Hosts list from test/common.js. | ||
| 19 | + test-https-connect-address-family : PASS,FLAKY | ||
| 20 | + test-tls-connect-address-family : PASS,FLAKY | ||
| 21 | + | ||
| 15 | 22 | [$system==macos] | |
| 16 | 23 | ||
| 17 | 24 | [$system==solaris] # Also applies to SmartOS | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,3 +30,9 @@ assert.equal( | |||
| 30 | 30 | }), | |
| 31 | 31 | '0.0.0.0:80:192.168.1.1' | |
| 32 | 32 | ); | |
| 33 | + | ||
| 34 | + for (const family of [0, null, undefined, 'bogus']) | ||
| 35 | + assert.strictEqual(agent.getName({ family }), 'localhost::'); | ||
| 36 | + | ||
| 37 | + for (const family of [4, 6]) | ||
| 38 | + assert.strictEqual(agent.getName({ family }), 'localhost:::' + family); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,28 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const https = require('https'); | ||
| 5 | + | ||
| 6 | + if (!common.hasIPv6) { | ||
| 7 | + common.skip('no IPv6 support'); | ||
| 8 | + return; | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + const ciphers = 'AECDH-NULL-SHA'; | ||
| 12 | + https.createServer({ ciphers }, function(req, res) { | ||
| 13 | + this.close(); | ||
| 14 | + res.end(); | ||
| 15 | + }).listen(common.PORT, '::1', function() { | ||
| 16 | + const options = { | ||
| 17 | + host: 'localhost', | ||
| 18 | + port: common.PORT, | ||
| 19 | + family: 6, | ||
| 20 | + ciphers: ciphers, | ||
| 21 | + rejectUnauthorized: false, | ||
| 22 | + }; | ||
| 23 | + // Will fail with ECONNREFUSED if the address family is not honored. | ||
| 24 | + https.get(options, common.mustCall(function() { | ||
| 25 | + assert.strictEqual('::1', this.socket.remoteAddress); | ||
| 26 | + this.destroy(); | ||
| 27 | + })); | ||
| 28 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,27 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const tls = require('tls'); | ||
| 5 | + | ||
| 6 | + if (!common.hasIPv6) { | ||
| 7 | + common.skip('no IPv6 support'); | ||
| 8 | + return; | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + const ciphers = 'AECDH-NULL-SHA'; | ||
| 12 | + tls.createServer({ ciphers }, function() { | ||
| 13 | + this.close(); | ||
| 14 | + }).listen(common.PORT, '::1', function() { | ||
| 15 | + const options = { | ||
| 16 | + host: 'localhost', | ||
| 17 | + port: common.PORT, | ||
| 18 | + family: 6, | ||
| 19 | + ciphers: ciphers, | ||
| 20 | + rejectUnauthorized: false, | ||
| 21 | + }; | ||
| 22 | + // Will fail with ECONNREFUSED if the address family is not honored. | ||
| 23 | + tls.connect(options).once('secureConnect', common.mustCall(function() { | ||
| 24 | + assert.strictEqual('::1', this.remoteAddress); | ||
| 25 | + this.destroy(); | ||
| 26 | + })); | ||
| 27 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments