Server IP : 85.214.239.14 / Your IP : 18.117.93.183 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/node_modules/npm/node_modules/@npmcli/agent/lib/ |
Upload File : |
'use strict' const dns = require('./dns') const normalizeOptions = (opts) => { const family = parseInt(opts.family ?? '0', 10) const keepAlive = opts.keepAlive ?? true const normalized = { // nodejs http agent options. these are all the defaults // but kept here to increase the likelihood of cache hits // https://nodejs.org/api/http.html#new-agentoptions keepAliveMsecs: keepAlive ? 1000 : undefined, maxSockets: opts.maxSockets ?? 15, maxTotalSockets: Infinity, maxFreeSockets: keepAlive ? 256 : undefined, scheduling: 'fifo', // then spread the rest of the options ...opts, // we already set these to their defaults that we want family, keepAlive, // our custom timeout options timeouts: { // the standard timeout option is mapped to our idle timeout // and then deleted below idle: opts.timeout ?? 0, connection: 0, response: 0, transfer: 0, ...opts.timeouts, }, // get the dns options that go at the top level of socket connection ...dns.getOptions({ family, ...opts.dns }), } // remove timeout since we already used it to set our own idle timeout delete normalized.timeout return normalized } const createKey = (obj) => { let key = '' const sorted = Object.entries(obj).sort((a, b) => a[0] - b[0]) for (let [k, v] of sorted) { if (v == null) { v = 'null' } else if (v instanceof URL) { v = v.toString() } else if (typeof v === 'object') { v = createKey(v) } key += `${k}:${v}:` } return key } const cacheOptions = ({ secureEndpoint, ...options }) => createKey({ secureEndpoint: !!secureEndpoint, // socket connect options family: options.family, hints: options.hints, localAddress: options.localAddress, // tls specific connect options strictSsl: secureEndpoint ? !!options.rejectUnauthorized : false, ca: secureEndpoint ? options.ca : null, cert: secureEndpoint ? options.cert : null, key: secureEndpoint ? options.key : null, // http agent options keepAlive: options.keepAlive, keepAliveMsecs: options.keepAliveMsecs, maxSockets: options.maxSockets, maxTotalSockets: options.maxTotalSockets, maxFreeSockets: options.maxFreeSockets, scheduling: options.scheduling, // timeout options timeouts: options.timeouts, // proxy proxy: options.proxy, }) module.exports = { normalizeOptions, cacheOptions, }