diff --git a/CHANGELOG.md b/CHANGELOG.md index d102a7c..386bcf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this package will be documented in this file. +## [1.4.4] - 2022-03-10 +### Fixed: +- Removed the dependency on the [`original`](https://www.npmjs.com/package/original) package. A transitive dependency of this package was flagged in [CVE-2022-0686](https://nvd.nist.gov/vuln/detail/CVE-2022-0686). + ## [1.4.3] - 2022-01-10 This release fixes a number of SSE spec compliance issues which do not affect usage in the LaunchDarkly SDKs, but could be relevant in other use cases. diff --git a/example/eventsource-polyfill.js b/example/eventsource-polyfill.js index d20f6f7..0e39a6e 100644 --- a/example/eventsource-polyfill.js +++ b/example/eventsource-polyfill.js @@ -2145,7 +2145,7 @@ if (typeof Object.create === 'function') { /**/ -var pna = __webpack_require__(6); +var pna = __webpack_require__(7); /**/ /**/ @@ -2364,59 +2364,6 @@ function objectToString(o) { /* 6 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -if (typeof process === 'undefined' || - !process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - "use strict"; // Copyright Joyent, Inc. and other Node contributors. // @@ -2441,8 +2388,8 @@ function nextTick(fn, arg1, arg2, arg3) { -var punycode = __webpack_require__(30); -var util = __webpack_require__(32); +var punycode = __webpack_require__(26); +var util = __webpack_require__(28); exports.parse = urlParse; exports.resolve = urlResolve; @@ -2517,7 +2464,7 @@ var protocolPattern = /^([a-z0-9.+-]+:)/i, 'gopher:': true, 'file:': true }, - querystring = __webpack_require__(33); + querystring = __webpack_require__(29); function urlParse(url, parseQueryString, slashesDenoteHost) { if (url && util.isObject(url) && url instanceof Url) return url; @@ -3152,6 +3099,59 @@ Url.prototype.parseHost = function() { }; +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +if (typeof process === 'undefined' || + !process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) + /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { @@ -3739,11 +3739,11 @@ module.exports = Array.isArray || function (arr) { /* 11 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(37) +/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(33) var response = __webpack_require__(13) -var extend = __webpack_require__(47) -var statusCodes = __webpack_require__(48) -var url = __webpack_require__(7) +var extend = __webpack_require__(43) +var statusCodes = __webpack_require__(44) +var url = __webpack_require__(6) var http = exports @@ -4147,7 +4147,7 @@ exports.Readable = exports; exports.Writable = __webpack_require__(18); exports.Duplex = __webpack_require__(4); exports.Transform = __webpack_require__(20); -exports.PassThrough = __webpack_require__(45); +exports.PassThrough = __webpack_require__(41); /***/ }), @@ -4180,7 +4180,7 @@ exports.PassThrough = __webpack_require__(45); /**/ -var pna = __webpack_require__(6); +var pna = __webpack_require__(7); /**/ module.exports = Readable; @@ -4226,7 +4226,7 @@ util.inherits = __webpack_require__(3); /**/ /**/ -var debugUtil = __webpack_require__(38); +var debugUtil = __webpack_require__(34); var debug = void 0; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); @@ -4235,7 +4235,7 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = __webpack_require__(39); +var BufferList = __webpack_require__(35); var destroyImpl = __webpack_require__(17); var StringDecoder; @@ -5192,7 +5192,7 @@ module.exports = __webpack_require__(8).EventEmitter; /**/ -var pna = __webpack_require__(6); +var pna = __webpack_require__(7); /**/ // undocumented cb() API, needed for core, not for public API @@ -5297,7 +5297,7 @@ module.exports = { /**/ -var pna = __webpack_require__(6); +var pna = __webpack_require__(7); /**/ module.exports = Writable; @@ -5340,7 +5340,7 @@ util.inherits = __webpack_require__(3); /**/ var internalUtil = { - deprecate: __webpack_require__(43) + deprecate: __webpack_require__(39) }; /**/ @@ -5955,7 +5955,7 @@ Writable.prototype._destroy = function (err, cb) { this.end(); cb(err); }; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(41).setImmediate, __webpack_require__(0))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(37).setImmediate, __webpack_require__(0))) /***/ }), /* 19 */ @@ -5987,7 +5987,7 @@ Writable.prototype._destroy = function (err, cb) { /**/ -var Buffer = __webpack_require__(44).Buffer; +var Buffer = __webpack_require__(40).Buffer; /**/ var isEncoding = Buffer.isEncoding || function (encoding) { @@ -6500,12 +6500,12 @@ if (typeof window === 'object') { /* WEBPACK VAR INJECTION */(function(process, Buffer) {var retryDelay = __webpack_require__(25) -var original = __webpack_require__(26) -var parse = __webpack_require__(7).parse +var parse = __webpack_require__(6).parse +var URL = __webpack_require__(6).URL var events = __webpack_require__(8) -var https = __webpack_require__(36) +var https = __webpack_require__(32) var http = __webpack_require__(11) -var util = __webpack_require__(49) +var util = __webpack_require__(45) var httpsOptions = [ 'pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers', @@ -6567,6 +6567,8 @@ function EventSource (url, eventSourceInitDict) { config.jitterRatio ? retryDelay.defaultJitter(config.jitterRatio) : null ) + var streamOriginUrl = new URL(url).origin + function makeRequestUrlAndOptions () { // Returns { url, options }; url is null/undefined if the URL properties are in options var actualUrl = url @@ -6845,7 +6847,7 @@ function EventSource (url, eventSourceInitDict) { var event = new MessageEvent(type, { data: data.slice(0, -1), // remove trailing newline lastEventId: lastEventId, - origin: original(url) + origin: streamOriginUrl }) data = '' eventId = undefined @@ -7363,777 +7365,6 @@ module.exports = { /* 26 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -var parse = __webpack_require__(27); - -/** - * Transform an URL to a valid origin value. - * - * @param {String|Object} url URL to transform to it's origin. - * @returns {String} The origin. - * @api public - */ -function origin(url) { - if ('string' === typeof url) url = parse(url); - - // - // 6.2. ASCII Serialization of an Origin - // http://tools.ietf.org/html/rfc6454#section-6.2 - // - if (!url.protocol || !url.hostname) return 'null'; - - // - // 4. Origin of a URI - // http://tools.ietf.org/html/rfc6454#section-4 - // - // States that url.scheme, host should be converted to lower case. This also - // makes it easier to match origins as everything is just lower case. - // - return (url.protocol +'//'+ url.host).toLowerCase(); -} - -/** - * Check if the origins are the same. - * - * @param {String} a URL or origin of a. - * @param {String} b URL or origin of b. - * @returns {Boolean} - * @api public - */ -origin.same = function same(a, b) { - return origin(a) === origin(b); -}; - -// -// Expose the origin -// -module.exports = origin; - - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) { - -var required = __webpack_require__(28) - , qs = __webpack_require__(29) - , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\// - , protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i - , windowsDriveLetter = /^[a-zA-Z]:/ - , whitespace = '[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]' - , left = new RegExp('^'+ whitespace +'+'); - -/** - * Trim a given string. - * - * @param {String} str String to trim. - * @public - */ -function trimLeft(str) { - return (str ? str : '').toString().replace(left, ''); -} - -/** - * These are the parse rules for the URL parser, it informs the parser - * about: - * - * 0. The char it Needs to parse, if it's a string it should be done using - * indexOf, RegExp using exec and NaN means set as current value. - * 1. The property we should set when parsing this value. - * 2. Indication if it's backwards or forward parsing, when set as number it's - * the value of extra chars that should be split off. - * 3. Inherit from location if non existing in the parser. - * 4. `toLowerCase` the resulting value. - */ -var rules = [ - ['#', 'hash'], // Extract from the back. - ['?', 'query'], // Extract from the back. - function sanitize(address, url) { // Sanitize what is left of the address - return isSpecial(url.protocol) ? address.replace(/\\/g, '/') : address; - }, - ['/', 'pathname'], // Extract from the back. - ['@', 'auth', 1], // Extract from the front. - [NaN, 'host', undefined, 1, 1], // Set left over value. - [/:(\d+)$/, 'port', undefined, 1], // RegExp the back. - [NaN, 'hostname', undefined, 1, 1] // Set left over. -]; - -/** - * These properties should not be copied or inherited from. This is only needed - * for all non blob URL's as a blob URL does not include a hash, only the - * origin. - * - * @type {Object} - * @private - */ -var ignore = { hash: 1, query: 1 }; - -/** - * The location object differs when your code is loaded through a normal page, - * Worker or through a worker using a blob. And with the blobble begins the - * trouble as the location object will contain the URL of the blob, not the - * location of the page where our code is loaded in. The actual origin is - * encoded in the `pathname` so we can thankfully generate a good "default" - * location from it so we can generate proper relative URL's again. - * - * @param {Object|String} loc Optional default location object. - * @returns {Object} lolcation object. - * @public - */ -function lolcation(loc) { - var globalVar; - - if (typeof window !== 'undefined') globalVar = window; - else if (typeof global !== 'undefined') globalVar = global; - else if (typeof self !== 'undefined') globalVar = self; - else globalVar = {}; - - var location = globalVar.location || {}; - loc = loc || location; - - var finaldestination = {} - , type = typeof loc - , key; - - if ('blob:' === loc.protocol) { - finaldestination = new Url(unescape(loc.pathname), {}); - } else if ('string' === type) { - finaldestination = new Url(loc, {}); - for (key in ignore) delete finaldestination[key]; - } else if ('object' === type) { - for (key in loc) { - if (key in ignore) continue; - finaldestination[key] = loc[key]; - } - - if (finaldestination.slashes === undefined) { - finaldestination.slashes = slashes.test(loc.href); - } - } - - return finaldestination; -} - -/** - * Check whether a protocol scheme is special. - * - * @param {String} The protocol scheme of the URL - * @return {Boolean} `true` if the protocol scheme is special, else `false` - * @private - */ -function isSpecial(scheme) { - return ( - scheme === 'file:' || - scheme === 'ftp:' || - scheme === 'http:' || - scheme === 'https:' || - scheme === 'ws:' || - scheme === 'wss:' - ); -} - -/** - * @typedef ProtocolExtract - * @type Object - * @property {String} protocol Protocol matched in the URL, in lowercase. - * @property {Boolean} slashes `true` if protocol is followed by "//", else `false`. - * @property {String} rest Rest of the URL that is not part of the protocol. - */ - -/** - * Extract protocol information from a URL with/without double slash ("//"). - * - * @param {String} address URL we want to extract from. - * @param {Object} location - * @return {ProtocolExtract} Extracted information. - * @private - */ -function extractProtocol(address, location) { - address = trimLeft(address); - location = location || {}; - - var match = protocolre.exec(address); - var protocol = match[1] ? match[1].toLowerCase() : ''; - var forwardSlashes = !!match[2]; - var otherSlashes = !!match[3]; - var slashesCount = 0; - var rest; - - if (forwardSlashes) { - if (otherSlashes) { - rest = match[2] + match[3] + match[4]; - slashesCount = match[2].length + match[3].length; - } else { - rest = match[2] + match[4]; - slashesCount = match[2].length; - } - } else { - if (otherSlashes) { - rest = match[3] + match[4]; - slashesCount = match[3].length; - } else { - rest = match[4] - } - } - - if (protocol === 'file:') { - if (slashesCount >= 2) { - rest = rest.slice(2); - } - } else if (isSpecial(protocol)) { - rest = match[4]; - } else if (protocol) { - if (forwardSlashes) { - rest = rest.slice(2); - } - } else if (slashesCount >= 2 && isSpecial(location.protocol)) { - rest = match[4]; - } - - return { - protocol: protocol, - slashes: forwardSlashes || isSpecial(protocol), - slashesCount: slashesCount, - rest: rest - }; -} - -/** - * Resolve a relative URL pathname against a base URL pathname. - * - * @param {String} relative Pathname of the relative URL. - * @param {String} base Pathname of the base URL. - * @return {String} Resolved pathname. - * @private - */ -function resolve(relative, base) { - if (relative === '') return base; - - var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/')) - , i = path.length - , last = path[i - 1] - , unshift = false - , up = 0; - - while (i--) { - if (path[i] === '.') { - path.splice(i, 1); - } else if (path[i] === '..') { - path.splice(i, 1); - up++; - } else if (up) { - if (i === 0) unshift = true; - path.splice(i, 1); - up--; - } - } - - if (unshift) path.unshift(''); - if (last === '.' || last === '..') path.push(''); - - return path.join('/'); -} - -/** - * The actual URL instance. Instead of returning an object we've opted-in to - * create an actual constructor as it's much more memory efficient and - * faster and it pleases my OCD. - * - * It is worth noting that we should not use `URL` as class name to prevent - * clashes with the global URL instance that got introduced in browsers. - * - * @constructor - * @param {String} address URL we want to parse. - * @param {Object|String} [location] Location defaults for relative paths. - * @param {Boolean|Function} [parser] Parser for the query string. - * @private - */ -function Url(address, location, parser) { - address = trimLeft(address); - - if (!(this instanceof Url)) { - return new Url(address, location, parser); - } - - var relative, extracted, parse, instruction, index, key - , instructions = rules.slice() - , type = typeof location - , url = this - , i = 0; - - // - // The following if statements allows this module two have compatibility with - // 2 different API: - // - // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments - // where the boolean indicates that the query string should also be parsed. - // - // 2. The `URL` interface of the browser which accepts a URL, object as - // arguments. The supplied object will be used as default values / fall-back - // for relative paths. - // - if ('object' !== type && 'string' !== type) { - parser = location; - location = null; - } - - if (parser && 'function' !== typeof parser) parser = qs.parse; - - location = lolcation(location); - - // - // Extract protocol information before running the instructions. - // - extracted = extractProtocol(address || '', location); - relative = !extracted.protocol && !extracted.slashes; - url.slashes = extracted.slashes || relative && location.slashes; - url.protocol = extracted.protocol || location.protocol || ''; - address = extracted.rest; - - // - // When the authority component is absent the URL starts with a path - // component. - // - if ( - extracted.protocol === 'file:' && ( - extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || - (!extracted.slashes && - (extracted.protocol || - extracted.slashesCount < 2 || - !isSpecial(url.protocol))) - ) { - instructions[3] = [/(.*)/, 'pathname']; - } - - for (; i < instructions.length; i++) { - instruction = instructions[i]; - - if (typeof instruction === 'function') { - address = instruction(address, url); - continue; - } - - parse = instruction[0]; - key = instruction[1]; - - if (parse !== parse) { - url[key] = address; - } else if ('string' === typeof parse) { - if (~(index = address.indexOf(parse))) { - if ('number' === typeof instruction[2]) { - url[key] = address.slice(0, index); - address = address.slice(index + instruction[2]); - } else { - url[key] = address.slice(index); - address = address.slice(0, index); - } - } - } else if ((index = parse.exec(address))) { - url[key] = index[1]; - address = address.slice(0, index.index); - } - - url[key] = url[key] || ( - relative && instruction[3] ? location[key] || '' : '' - ); - - // - // Hostname, host and protocol should be lowercased so they can be used to - // create a proper `origin`. - // - if (instruction[4]) url[key] = url[key].toLowerCase(); - } - - // - // Also parse the supplied query string in to an object. If we're supplied - // with a custom parser as function use that instead of the default build-in - // parser. - // - if (parser) url.query = parser(url.query); - - // - // If the URL is relative, resolve the pathname against the base URL. - // - if ( - relative - && location.slashes - && url.pathname.charAt(0) !== '/' - && (url.pathname !== '' || location.pathname !== '') - ) { - url.pathname = resolve(url.pathname, location.pathname); - } - - // - // Default to a / for pathname if none exists. This normalizes the URL - // to always have a / - // - if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) { - url.pathname = '/' + url.pathname; - } - - // - // We should not add port numbers if they are already the default port number - // for a given protocol. As the host also contains the port number we're going - // override it with the hostname which contains no port number. - // - if (!required(url.port, url.protocol)) { - url.host = url.hostname; - url.port = ''; - } - - // - // Parse down the `auth` for the username and password. - // - url.username = url.password = ''; - if (url.auth) { - instruction = url.auth.split(':'); - url.username = instruction[0]; - url.password = instruction[1] || ''; - } - - url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host - ? url.protocol +'//'+ url.host - : 'null'; - - // - // The href is just the compiled result. - // - url.href = url.toString(); -} - -/** - * This is convenience method for changing properties in the URL instance to - * insure that they all propagate correctly. - * - * @param {String} part Property we need to adjust. - * @param {Mixed} value The newly assigned value. - * @param {Boolean|Function} fn When setting the query, it will be the function - * used to parse the query. - * When setting the protocol, double slash will be - * removed from the final url if it is true. - * @returns {URL} URL instance for chaining. - * @public - */ -function set(part, value, fn) { - var url = this; - - switch (part) { - case 'query': - if ('string' === typeof value && value.length) { - value = (fn || qs.parse)(value); - } - - url[part] = value; - break; - - case 'port': - url[part] = value; - - if (!required(value, url.protocol)) { - url.host = url.hostname; - url[part] = ''; - } else if (value) { - url.host = url.hostname +':'+ value; - } - - break; - - case 'hostname': - url[part] = value; - - if (url.port) value += ':'+ url.port; - url.host = value; - break; - - case 'host': - url[part] = value; - - if (/:\d+$/.test(value)) { - value = value.split(':'); - url.port = value.pop(); - url.hostname = value.join(':'); - } else { - url.hostname = value; - url.port = ''; - } - - break; - - case 'protocol': - url.protocol = value.toLowerCase(); - url.slashes = !fn; - break; - - case 'pathname': - case 'hash': - if (value) { - var char = part === 'pathname' ? '/' : '#'; - url[part] = value.charAt(0) !== char ? char + value : value; - } else { - url[part] = value; - } - break; - - case 'username': - case 'password': - url[part] = encodeURIComponent(value); - break; - - case 'auth': - var splits = value.split(':'); - url.username = splits[0]; - url.password = splits.length === 2 ? splits[1] : ''; - } - - for (var i = 0; i < rules.length; i++) { - var ins = rules[i]; - - if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase(); - } - - url.auth = url.password ? url.username +':'+ url.password : url.username; - - url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host - ? url.protocol +'//'+ url.host - : 'null'; - - url.href = url.toString(); - - return url; -} - -/** - * Transform the properties back in to a valid and full URL string. - * - * @param {Function} stringify Optional query stringify function. - * @returns {String} Compiled version of the URL. - * @public - */ -function toString(stringify) { - if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify; - - var query - , url = this - , protocol = url.protocol; - - if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':'; - - var result = - protocol + - ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : ''); - - if (url.username) { - result += url.username; - if (url.password) result += ':'+ url.password; - result += '@'; - } else if (url.password) { - result += ':'+ url.password; - result += '@'; - } - - result += url.host + url.pathname; - - query = 'object' === typeof url.query ? stringify(url.query) : url.query; - if (query) result += '?' !== query.charAt(0) ? '?'+ query : query; - - if (url.hash) result += url.hash; - - return result; -} - -Url.prototype = { set: set, toString: toString }; - -// -// Expose the URL parser and some additional properties that might be useful for -// others or testing. -// -Url.extractProtocol = extractProtocol; -Url.location = lolcation; -Url.trimLeft = trimLeft; -Url.qs = qs; - -module.exports = Url; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Check if we're required to add a port number. - * - * @see https://url.spec.whatwg.org/#default-port - * @param {Number|String} port Port number we need to check - * @param {String} protocol Protocol we need to check against. - * @returns {Boolean} Is it a default port for the given protocol - * @api private - */ -module.exports = function required(port, protocol) { - protocol = protocol.split(':')[0]; - port = +port; - - if (!port) return false; - - switch (protocol) { - case 'http': - case 'ws': - return port !== 80; - - case 'https': - case 'wss': - return port !== 443; - - case 'ftp': - return port !== 21; - - case 'gopher': - return port !== 70; - - case 'file': - return false; - } - - return port !== 0; -}; - - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var has = Object.prototype.hasOwnProperty - , undef; - -/** - * Decode a URI encoded string. - * - * @param {String} input The URI encoded string. - * @returns {String|Null} The decoded string. - * @api private - */ -function decode(input) { - try { - return decodeURIComponent(input.replace(/\+/g, ' ')); - } catch (e) { - return null; - } -} - -/** - * Attempts to encode a given input. - * - * @param {String} input The string that needs to be encoded. - * @returns {String|Null} The encoded string. - * @api private - */ -function encode(input) { - try { - return encodeURIComponent(input); - } catch (e) { - return null; - } -} - -/** - * Simple query string parser. - * - * @param {String} query The query string that needs to be parsed. - * @returns {Object} - * @api public - */ -function querystring(query) { - var parser = /([^=?#&]+)=?([^&]*)/g - , result = {} - , part; - - while (part = parser.exec(query)) { - var key = decode(part[1]) - , value = decode(part[2]); - - // - // Prevent overriding of existing properties. This ensures that build-in - // methods like `toString` or __proto__ are not overriden by malicious - // querystrings. - // - // In the case if failed decoding, we want to omit the key/value pairs - // from the result. - // - if (key === null || value === null || key in result) continue; - result[key] = value; - } - - return result; -} - -/** - * Transform a query string to an object. - * - * @param {Object} obj Object that should be transformed. - * @param {String} prefix Optional prefix. - * @returns {String} - * @api public - */ -function querystringify(obj, prefix) { - prefix = prefix || ''; - - var pairs = [] - , value - , key; - - // - // Optionally prefix with a '?' if needed - // - if ('string' !== typeof prefix) prefix = '?'; - - for (key in obj) { - if (has.call(obj, key)) { - value = obj[key]; - - // - // Edge cases where we actually want to encode the value to an empty - // string instead of the stringified value. - // - if (!value && (value === null || value === undef || isNaN(value))) { - value = ''; - } - - key = encode(key); - value = encode(value); - - // - // If we failed to encode the strings, we should bail out as we don't - // want to add invalid strings to the query. - // - if (key === null || value === null) continue; - pairs.push(key +'='+ value); - } - } - - return pairs.length ? prefix + pairs.join('&') : ''; -} - -// -// Expose the module. -// -exports.stringify = querystringify; -exports.parse = querystring; - - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { @@ -8667,10 +7898,10 @@ exports.parse = querystring; }(this)); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(31)(module), __webpack_require__(0))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(27)(module), __webpack_require__(0))) /***/ }), -/* 31 */ +/* 27 */ /***/ (function(module, exports) { module.exports = function(module) { @@ -8698,7 +7929,7 @@ module.exports = function(module) { /***/ }), -/* 32 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8721,18 +7952,18 @@ module.exports = { /***/ }), -/* 33 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -exports.decode = exports.parse = __webpack_require__(34); -exports.encode = exports.stringify = __webpack_require__(35); +exports.decode = exports.parse = __webpack_require__(30); +exports.encode = exports.stringify = __webpack_require__(31); /***/ }), -/* 34 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8823,7 +8054,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 35 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8915,11 +8146,11 @@ var objectKeys = Object.keys || function (obj) { /***/ }), -/* 36 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { var http = __webpack_require__(11) -var url = __webpack_require__(7) +var url = __webpack_require__(6) var https = module.exports @@ -8952,14 +8183,14 @@ function validateParams (params) { /***/ }), -/* 37 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer, global, process) {var capability = __webpack_require__(12) var inherits = __webpack_require__(3) var response = __webpack_require__(13) var stream = __webpack_require__(14) -var toArrayBuffer = __webpack_require__(46) +var toArrayBuffer = __webpack_require__(42) var IncomingMessage = response.IncomingMessage var rStates = response.readyStates @@ -9286,13 +8517,13 @@ var unsafeHeaders = [ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer, __webpack_require__(0), __webpack_require__(1))) /***/ }), -/* 38 */ +/* 34 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 39 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9301,7 +8532,7 @@ var unsafeHeaders = [ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Buffer = __webpack_require__(9).Buffer; -var util = __webpack_require__(40); +var util = __webpack_require__(36); function copyBuffer(src, target, offset) { src.copy(target, offset); @@ -9377,13 +8608,13 @@ if (util && util.inspect && util.inspect.custom) { } /***/ }), -/* 40 */ +/* 36 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 41 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) || @@ -9439,7 +8670,7 @@ exports._unrefActive = exports.active = function(item) { }; // setimmediate attaches itself to the global object -__webpack_require__(42); +__webpack_require__(38); // On some exotic environments, it's not clear which object `setimmediate` was // able to install onto. Search each possibility in the same order as the // `setimmediate` library. @@ -9453,7 +8684,7 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 42 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { @@ -9646,7 +8877,7 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1))) /***/ }), -/* 43 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { @@ -9720,7 +8951,7 @@ function config (name) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 44 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable node/no-deprecated-api */ @@ -9788,7 +9019,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/* 45 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9841,7 +9072,7 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { }; /***/ }), -/* 46 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { var Buffer = __webpack_require__(2).Buffer @@ -9874,7 +9105,7 @@ module.exports = function (buf) { /***/ }), -/* 47 */ +/* 43 */ /***/ (function(module, exports) { module.exports = extend @@ -9899,7 +9130,7 @@ function extend() { /***/ }), -/* 48 */ +/* 44 */ /***/ (function(module, exports) { module.exports = { @@ -9969,7 +9200,7 @@ module.exports = { /***/ }), -/* 49 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. @@ -10507,7 +9738,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = __webpack_require__(50); +exports.isBuffer = __webpack_require__(46); function objectToString(o) { return Object.prototype.toString.call(o); @@ -10551,7 +9782,7 @@ exports.log = function() { * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ -exports.inherits = __webpack_require__(51); +exports.inherits = __webpack_require__(47); exports._extend = function(origin, add) { // Don't do anything if add isn't an object @@ -10679,7 +9910,7 @@ exports.callbackify = callbackify; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) /***/ }), -/* 50 */ +/* 46 */ /***/ (function(module, exports) { module.exports = function isBuffer(arg) { @@ -10690,7 +9921,7 @@ module.exports = function isBuffer(arg) { } /***/ }), -/* 51 */ +/* 47 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { diff --git a/package.json b/package.json index 7270578..7cbb2e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "launchdarkly-eventsource", - "version": "1.4.3", + "version": "1.4.4", "description": "Fork of eventsource package - W3C compliant EventSource client for Node.js and browser (polyfill)", "keywords": [ "eventsource",