Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,16 @@ Agent.prototype.createConnection = function createConnection(...args) {

// Get the key for a given set of request options
Agent.prototype.getName = function getName(options = kEmptyObject) {
let name = options.host || 'localhost';

name += ':';
if (options.port)
name += options.port;

name += ':';
if (options.localAddress)
name += options.localAddress;
const { host = 'localhost', port, localAddress, family, socketPath } = options;
let name = `${host}:${port || ''}:${localAddress || ''}`;

// Pacify parallel/test-http-agent-getname by only appending
// the ':' when options.family is set.
if (options.family === 4 || options.family === 6)
name += `:${options.family}`;
if (family === 4 || family === 6)
name += `:${family}`;

if (options.socketPath)
name += `:${options.socketPath}`;
if (socketPath)
name += `:${socketPath}`;

return name;
};
Expand Down