Lines Matching refs:options
90 function Agent(options) {
92 return new Agent(options);
99 this.options = { __proto__: null, ...options };
101 if (this.options.noDelay === undefined)
102 this.options.noDelay = true;
105 this.options.path = null;
109 this.keepAliveMsecs = this.options.keepAliveMsecs || 1000;
110 this.keepAlive = this.options.keepAlive || false;
111 this.maxSockets = this.options.maxSockets || Agent.defaultMaxSockets;
112 this.maxFreeSockets = this.options.maxFreeSockets || 256;
113 this.scheduling = this.options.scheduling || 'lifo';
114 this.maxTotalSockets = this.options.maxTotalSockets;
125 this.on('free', (socket, options) => {
126 const name = this.getName(options);
184 this.removeSocket(socket, options);
216 // Get the key for a given set of request options
217 Agent.prototype.getName = function getName(options = kEmptyObject) {
218 let name = options.host || 'localhost';
221 if (options.port)
222 name += options.port;
225 if (options.localAddress)
226 name += options.localAddress;
229 // the ':' when options.family is set.
230 if (options.family === 4 || options.family === 6)
231 name += `:${options.family}`;
233 if (options.socketPath)
234 name += `:${options.socketPath}`;
239 Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
242 if (typeof options === 'string') {
243 options = {
245 host: options,
251 options = { __proto__: null, ...options, ...this.options };
252 if (options.socketPath)
253 options.path = options.socketPath;
255 if (!options.servername && options.servername !== '')
256 options.servername = calculateServerName(options, req);
258 const name = this.getName(options);
288 this.createSocket(req, options, (err, socket) => {
302 req[kRequestOptions] = options;
310 Agent.prototype.createSocket = function createSocket(req, options, cb) {
311 options = { __proto__: null, ...options, ...this.options };
312 if (options.socketPath)
313 options.path = options.socketPath;
315 if (!options.servername && options.servername !== '')
316 options.servername = calculateServerName(options, req);
318 const name = this.getName(options);
319 options._agentKey = name;
321 debug('createConnection', name, options);
322 options.encoding = null;
333 installListeners(this, s, options);
336 // When keepAlive is true, pass the related options to createConnection
338 options.keepAlive = this.keepAlive;
339 options.keepAliveInitialDelay = this.keepAliveMsecs;
341 const newSocket = this.createConnection(options, oncreate);
346 function calculateServerName(options, req) {
347 let servername = options.host;
350 validateString(hostHeader, 'options.headers.host');
374 function installListeners(agent, s, options) {
377 agent.emit('free', s, options);
387 agent.removeSocket(s, options);
411 agent.removeSocket(s, options);
424 Agent.prototype.removeSocket = function removeSocket(s, options) {
425 const name = this.getName(options);
464 options = req[kRequestOptions];
469 if (req && options) {
472 this.createSocket(req, options, (err, socket) => {
486 const agentTimeout = this.options.timeout || 0;
517 const agentTimeout = agent.options.timeout || 0;