diff options
author | Dirceu Pereira Tiegs <dirceutiegs@gmail.com> | 2016-02-10 22:59:25 -0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2016-05-19 12:01:57 +0200 |
commit | fe77de196c0fb98eb7d57402946fb295663f886f (patch) | |
tree | db359c7d5c5c52e30ae31f53c90fc4194f68216b /test | |
parent | b90c52e38d47952bf6bef59d9a1c116b1972b8d9 (diff) | |
download | android-node-v8-fe77de196c0fb98eb7d57402946fb295663f886f.tar.gz android-node-v8-fe77de196c0fb98eb7d57402946fb295663f886f.tar.bz2 android-node-v8-fe77de196c0fb98eb7d57402946fb295663f886f.zip |
http: use `localAddress` instead of `path`
Fix `options` usage on `lib/_http_agent.js` for the Legacy API.
Fixes: https://github.com/nodejs/node/issues/5051
PR-URL: https://github.com/nodejs/node/pull/5190
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-regress-GH-5051.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/parallel/test-regress-GH-5051.js b/test/parallel/test-regress-GH-5051.js new file mode 100644 index 0000000000..a86d0943d3 --- /dev/null +++ b/test/parallel/test-regress-GH-5051.js @@ -0,0 +1,31 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const agent = require('http').globalAgent; + +// small stub just so we can call addRequest directly +const req = { + getHeader: function() {} +}; + +agent.maxSockets = 0; + +// localAddress is used when naming requests / sockets +// while using the Legacy API +agent.addRequest(req, 'localhost', common.PORT, '127.0.0.1'); +assert.equal(Object.keys(agent.requests).length, 1); +assert.equal( + Object.keys(agent.requests)[0], + 'localhost:' + common.PORT + ':127.0.0.1'); + +// path is *not* used when naming requests / sockets +agent.addRequest(req, { + host: 'localhost', + port: common.PORT, + localAddress: '127.0.0.1', + path: '/foo' +}); +assert.equal(Object.keys(agent.requests).length, 1); +assert.equal( + Object.keys(agent.requests)[0], + 'localhost:' + common.PORT + ':127.0.0.1'); |