diff options
author | Bryan English <bryan@bryanenglish.com> | 2017-05-25 00:32:04 -0700 |
---|---|---|
committer | Bryan English <bryan@bryanenglish.com> | 2017-09-27 18:31:17 -0700 |
commit | 2043944a4c62de60e7a04e8c914b565114c4b11b (patch) | |
tree | 8968545721889a1b539057b9b60576da60341a1a /test/parallel/test-http-agent-getname.js | |
parent | 510cab7a3d12ee95e0b04f9682c07d0d8a8d84a5 (diff) | |
download | android-node-v8-2043944a4c62de60e7a04e8c914b565114c4b11b.tar.gz android-node-v8-2043944a4c62de60e7a04e8c914b565114c4b11b.tar.bz2 android-node-v8-2043944a4c62de60e7a04e8c914b565114c4b11b.zip |
http: client keep-alive for UNIX domain sockets
Makes `Connection: keep-alive` behave correctly when making client
connections to UNIX domain sockets.
Prior to this, connections would never be re-used, but the keep-alive
would cause the connections to stick around until they time out. This
would lead to an eventual EMFILE error due to all the connections
staying open. This was due to http.Agent not properly supporting UNIX
domain sockets.
PR-URL: https://github.com/nodejs/node/pull/13214
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-http-agent-getname.js')
-rw-r--r-- | test/parallel/test-http-agent-getname.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/parallel/test-http-agent-getname.js b/test/parallel/test-http-agent-getname.js index f84996ec01..4b4e9ac26b 100644 --- a/test/parallel/test-http-agent-getname.js +++ b/test/parallel/test-http-agent-getname.js @@ -1,8 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); +const path = require('path'); const agent = new http.Agent(); @@ -31,6 +32,15 @@ assert.strictEqual( '0.0.0.0:80:192.168.1.1' ); +// unix socket +const socketPath = path.join(common.tmpDir, 'foo', 'bar'); +assert.strictEqual( + agent.getName({ + socketPath + }), + `localhost:::${socketPath}` +); + for (const family of [0, null, undefined, 'bogus']) assert.strictEqual(agent.getName({ family }), 'localhost::'); |