diff options
Diffstat (limited to 'node_modules/http2-wrapper/source/utils')
5 files changed, 0 insertions, 117 deletions
diff --git a/node_modules/http2-wrapper/source/utils/calculate-server-name.js b/node_modules/http2-wrapper/source/utils/calculate-server-name.js deleted file mode 100644 index b05c099..0000000 --- a/node_modules/http2-wrapper/source/utils/calculate-server-name.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -const net = require('net'); -/* istanbul ignore file: https://github.com/nodejs/node/blob/v13.0.1/lib/_http_agent.js */ - -module.exports = options => { - let servername = options.host; - const hostHeader = options.headers && options.headers.host; - - if (hostHeader) { - if (hostHeader.startsWith('[')) { - const index = hostHeader.indexOf(']'); - if (index === -1) { - servername = hostHeader; - } else { - servername = hostHeader.slice(1, -1); - } - } else { - servername = hostHeader.split(':', 1)[0]; - } - } - - if (net.isIP(servername)) { - return ''; - } - - return servername; -}; diff --git a/node_modules/http2-wrapper/source/utils/errors.js b/node_modules/http2-wrapper/source/utils/errors.js deleted file mode 100644 index 5018283..0000000 --- a/node_modules/http2-wrapper/source/utils/errors.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; -/* istanbul ignore file: https://github.com/nodejs/node/blob/master/lib/internal/errors.js */ - -const makeError = (Base, key, getMessage) => { - module.exports[key] = class NodeError extends Base { - constructor(...args) { - super(typeof getMessage === 'string' ? getMessage : getMessage(args)); - this.name = `${super.name} [${key}]`; - this.code = key; - } - }; -}; - -makeError(TypeError, 'ERR_INVALID_ARG_TYPE', args => { - const type = args[0].includes('.') ? 'property' : 'argument'; - - let valid = args[1]; - const isManyTypes = Array.isArray(valid); - - if (isManyTypes) { - valid = `${valid.slice(0, -1).join(', ')} or ${valid.slice(-1)}`; - } - - return `The "${args[0]}" ${type} must be ${isManyTypes ? 'one of' : 'of'} type ${valid}. Received ${typeof args[2]}`; -}); - -makeError(TypeError, 'ERR_INVALID_PROTOCOL', args => { - return `Protocol "${args[0]}" not supported. Expected "${args[1]}"`; -}); - -makeError(Error, 'ERR_HTTP_HEADERS_SENT', args => { - return `Cannot ${args[0]} headers after they are sent to the client`; -}); - -makeError(TypeError, 'ERR_INVALID_HTTP_TOKEN', args => { - return `${args[0]} must be a valid HTTP token [${args[1]}]`; -}); - -makeError(TypeError, 'ERR_HTTP_INVALID_HEADER_VALUE', args => { - return `Invalid value "${args[0]} for header "${args[1]}"`; -}); - -makeError(TypeError, 'ERR_INVALID_CHAR', args => { - return `Invalid character in ${args[0]} [${args[1]}]`; -}); diff --git a/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js b/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js deleted file mode 100644 index bed31cd..0000000 --- a/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -module.exports = header => { - switch (header) { - case ':method': - case ':scheme': - case ':authority': - case ':path': - return true; - default: - return false; - } -}; diff --git a/node_modules/http2-wrapper/source/utils/proxy-events.js b/node_modules/http2-wrapper/source/utils/proxy-events.js deleted file mode 100644 index 35e2ae0..0000000 --- a/node_modules/http2-wrapper/source/utils/proxy-events.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -module.exports = (from, to, events) => { - for (const event of events) { - from.on(event, (...args) => to.emit(event, ...args)); - } -}; diff --git a/node_modules/http2-wrapper/source/utils/url-to-options.js b/node_modules/http2-wrapper/source/utils/url-to-options.js deleted file mode 100644 index 36d1580..0000000 --- a/node_modules/http2-wrapper/source/utils/url-to-options.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; -/* istanbul ignore file: https://github.com/nodejs/node/blob/a91293d4d9ab403046ab5eb022332e4e3d249bd3/lib/internal/url.js#L1257 */ - -module.exports = url => { - const options = { - protocol: url.protocol, - hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, - host: url.host, - hash: url.hash, - search: url.search, - pathname: url.pathname, - href: url.href, - path: `${url.pathname || ''}${url.search || ''}` - }; - - if (typeof url.port === 'string' && url.port.length !== 0) { - options.port = Number(url.port); - } - - if (url.username || url.password) { - options.auth = `${url.username || ''}:${url.password || ''}`; - } - - return options; -}; |