Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarcy Clarke <darcy@darcyclarke.me>2020-12-12 00:25:19 +0300
committerDarcy Clarke <darcy@darcyclarke.me>2020-12-12 00:25:19 +0300
commita864931088ab212996c5121dc19caca03db006a4 (patch)
tree3ae989016a10fb893cf8df53a0851ace86a145c9
parenta844b709dba837b2c5dabeb78548ba7cbfc7e5ab (diff)
chore: remove unused top level dep tough-cookiedarcyclarke/remove-extraneous-tough-cookie
-rw-r--r--node_modules/tough-cookie/LICENSE12
-rw-r--r--node_modules/tough-cookie/README.md527
-rw-r--r--node_modules/tough-cookie/lib/cookie.js1488
-rw-r--r--node_modules/tough-cookie/lib/memstore.js181
-rw-r--r--node_modules/tough-cookie/lib/pathMatch.js61
-rw-r--r--node_modules/tough-cookie/lib/permuteDomain.js56
-rw-r--r--node_modules/tough-cookie/lib/pubsuffix-psl.js38
-rw-r--r--node_modules/tough-cookie/lib/store.js75
-rw-r--r--node_modules/tough-cookie/lib/version.js2
-rw-r--r--node_modules/tough-cookie/package.json79
10 files changed, 0 insertions, 2519 deletions
diff --git a/node_modules/tough-cookie/LICENSE b/node_modules/tough-cookie/LICENSE
deleted file mode 100644
index 22204e875..000000000
--- a/node_modules/tough-cookie/LICENSE
+++ /dev/null
@@ -1,12 +0,0 @@
-Copyright (c) 2015, Salesforce.com, Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/tough-cookie/README.md b/node_modules/tough-cookie/README.md
deleted file mode 100644
index 656a25556..000000000
--- a/node_modules/tough-cookie/README.md
+++ /dev/null
@@ -1,527 +0,0 @@
-[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js
-
-[![npm package](https://nodei.co/npm/tough-cookie.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/tough-cookie/)
-
-[![Build Status](https://travis-ci.org/salesforce/tough-cookie.png?branch=master)](https://travis-ci.org/salesforce/tough-cookie)
-
-# Synopsis
-
-``` javascript
-var tough = require('tough-cookie');
-var Cookie = tough.Cookie;
-var cookie = Cookie.parse(header);
-cookie.value = 'somethingdifferent';
-header = cookie.toString();
-
-var cookiejar = new tough.CookieJar();
-cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);
-// ...
-cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {
- res.headers['cookie'] = cookies.join('; ');
-});
-```
-
-# Installation
-
-It's _so_ easy!
-
-`npm install tough-cookie`
-
-Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.
-
-## Version Support
-
-Support for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module.
-
-# API
-
-## tough
-
-Functions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be "bound".
-
-**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary.
-
-### `parseDate(string)`
-
-Parse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`.
-
-### `formatDate(date)`
-
-Format a Date into a RFC1123 string (the RFC6265-recommended format).
-
-### `canonicalDomain(str)`
-
-Transforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).
-
-### `domainMatch(str,domStr[,canonicalize=true])`
-
-Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain-name and the `domStr` is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match".
-
-The `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.
-
-### `defaultPath(path)`
-
-Given a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC.
-
-The `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.
-
-### `pathMatch(reqPath,cookiePath)`
-
-Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. Returns a boolean.
-
-This is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.
-
-### `parse(cookieString[, options])`
-
-alias for `Cookie.parse(cookieString[, options])`
-
-### `fromJSON(string)`
-
-alias for `Cookie.fromJSON(string)`
-
-### `getPublicSuffix(hostname)`
-
-Returns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.
-
-For example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.
-
-For further information, see http://publicsuffix.org/. This module derives its list from that site. This call is currently a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [get() method](https://www.npmjs.com/package/psl#pslgetdomain).
-
-### `cookieCompare(a,b)`
-
-For use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence:
-
-* Longest `.path`
-* oldest `.creation` (which has a 1ms precision, same as `Date`)
-* lowest `.creationIndex` (to get beyond the 1ms precision)
-
-``` javascript
-var cookies = [ /* unsorted array of Cookie objects */ ];
-cookies = cookies.sort(cookieCompare);
-```
-
-**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same milisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.
-
-### `permuteDomain(domain)`
-
-Generates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.
-
-### `permutePath(path)`
-
-Generates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.
-
-
-## Cookie
-
-Exported via `tough.Cookie`.
-
-### `Cookie.parse(cookieString[, options])`
-
-Parses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.
-
-The options parameter is not required and currently has only one property:
-
- * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant.
-
-If options is not an object, it is ignored, which means you can use `Array#map` with it.
-
-Here's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:
-
-``` javascript
-if (res.headers['set-cookie'] instanceof Array)
- cookies = res.headers['set-cookie'].map(Cookie.parse);
-else
- cookies = [Cookie.parse(res.headers['set-cookie'])];
-```
-
-_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed.
-See [Issue 92](https://github.com/salesforce/tough-cookie/issues/92)
-
-### Properties
-
-Cookie object properties:
-
- * _key_ - string - the name or key of the cookie (default "")
- * _value_ - string - the value of the cookie (default "")
- * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `"Infinity"`). See `setExpires()`
- * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `"Infinity"` and `"-Infinity"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`
- * _domain_ - string - the `Domain=` attribute of the cookie
- * _path_ - string - the `Path=` of the cookie
- * _secure_ - boolean - the `Secure` cookie flag
- * _httpOnly_ - boolean - the `HttpOnly` cookie flag
- * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)
- * _creation_ - `Date` - when this cookie was constructed
- * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation)
-
-After a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:
-
- * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)
- * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.
- * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar
- * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.
-
-### `Cookie([{properties}])`
-
-Receives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties.
-
-### `.toString()`
-
-encode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.
-
-### `.cookieString()`
-
-encode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').
-
-### `.setExpires(String)`
-
-sets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `"Infinity"` (a string) is set.
-
-### `.setMaxAge(number)`
-
-sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity` to `"Infinity"` so it JSON serializes correctly.
-
-### `.expiryTime([now=Date.now()])`
-
-### `.expiryDate([now=Date.now()])`
-
-expiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.
-
-Max-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.
-
-If Expires (`.expires`) is set, that's returned.
-
-Otherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for "Tue, 19 Jan 2038 03:14:07 GMT" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).
-
-### `.TTL([now=Date.now()])`
-
-compute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.
-
-The "number" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.
-
-### `.canonicalizedDomain()`
-
-### `.cdomain()`
-
-return the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.
-
-### `.toJSON()`
-
-For convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized.
-
-Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).
-
-**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.
-
-### `Cookie.fromJSON(strOrObj)`
-
-Does the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first.
-
-Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer.
-
-Returns `null` upon JSON parsing error.
-
-### `.clone()`
-
-Does a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`.
-
-### `.validate()`
-
-Status: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.
-
-validates cookie attributes for semantic correctness. Useful for "lint" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:
-
-``` javascript
-if (cookie.validate() === true) {
- // it's tasty
-} else {
- // yuck!
-}
-```
-
-
-## CookieJar
-
-Exported via `tough.CookieJar`.
-
-### `CookieJar([store],[options])`
-
-Simply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.
-
-The `options` object can be omitted and can have the following properties:
-
- * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like "com" and "co.uk"
- * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.
- This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers.
-
-Since eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.
-
-### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))`
-
-Attempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties.
-
-The `options` object can be omitted and can have the following properties:
-
- * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.
- * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
- * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies
- * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.
-
-As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).
-
-### `.setCookieSync(cookieOrString, currentUrl, [{options}])`
-
-Synchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
-
-### `.getCookies(currentUrl, [{options},] cb(err,cookies))`
-
-Retrieve the list of cookies that can be sent in a Cookie header for the current url.
-
-If an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.
-
-The `options` object can be omitted and can have the following properties:
-
- * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.
- * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
- * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies
- * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).
- * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).
-
-The `.lastAccessed` property of the returned cookies will have been updated.
-
-### `.getCookiesSync(currentUrl, [{options}])`
-
-Synchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
-
-### `.getCookieString(...)`
-
-Accepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.
-
-### `.getCookieStringSync(...)`
-
-Synchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
-
-### `.getSetCookieStrings(...)`
-
-Returns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.
-
-### `.getSetCookieStringsSync(...)`
-
-Synchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
-
-### `.serialize(cb(err,serializedObject))`
-
-Serialize the Jar if the underlying store supports `.getAllCookies`.
-
-**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.
-
-See [Serialization Format].
-
-### `.serializeSync()`
-
-Sync version of .serialize
-
-### `.toJSON()`
-
-Alias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`.
-
-### `CookieJar.deserialize(serialized, [store], cb(err,object))`
-
-A new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization.
-
-The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created.
-
-As a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback.
-
-### `CookieJar.deserializeSync(serialized, [store])`
-
-Sync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work.
-
-### `CookieJar.fromJSON(string)`
-
-Alias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`.
-
-### `.clone([store,]cb(err,newJar))`
-
-Produces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa.
-
-The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`.
-
-### `.cloneSync([store])`
-
-Synchronous version of `.clone`, returning a new `CookieJar` instance.
-
-The `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used.
-
-The _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls.
-
-### `.removeAllCookies(cb(err))`
-
-Removes all cookies from the jar.
-
-This is a new backwards-compatible feature of `tough-cookie` version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement `removeAllCookies`, the fallback is to call `removeCookie` after `getAllCookies`. If `getAllCookies` fails or isn't implemented in the Store, that error is returned. If one or more of the `removeCookie` calls fail, only the first error is returned.
-
-### `.removeAllCookiesSync()`
-
-Sync version of `.removeAllCookies()`
-
-## Store
-
-Base class for CookieJar stores. Available as `tough.Store`.
-
-## Store API
-
-The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.
-
-Stores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`.
-
-Stores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style
-
-All `domain` parameters will have been normalized before calling.
-
-The Cookie store must have all of the following methods.
-
-### `store.findCookie(domain, path, key, cb(err,cookie))`
-
-Retrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.
-
-Callback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).
-
-### `store.findCookies(domain, path, cb(err,cookies))`
-
-Locates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.
-
-If no cookies are found, the callback MUST be passed an empty array.
-
-The resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.
-
-As of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).
-
-### `store.putCookie(cookie, cb(err))`
-
-Adds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.
-
-The `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.
-
-Pass an error if the cookie cannot be stored.
-
-### `store.updateCookie(oldCookie, newCookie, cb(err))`
-
-Update an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.
-
-The `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement).
-
-Stores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.
-
-The `newCookie` and `oldCookie` objects MUST NOT be modified.
-
-Pass an error if the newCookie cannot be stored.
-
-### `store.removeCookie(domain, path, key, cb(err))`
-
-Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).
-
-The implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.
-
-### `store.removeCookies(domain, path, cb(err))`
-
-Removes matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.
-
-Pass an error ONLY if removing any existing cookies failed.
-
-### `store.removeAllCookies(cb(err))`
-
-_Optional_. Removes all cookies from the store.
-
-Pass an error if one or more cookies can't be removed.
-
-**Note**: New method as of `tough-cookie` version 2.5, so not all Stores will implement this, plus some stores may choose not to implement this.
-
-### `store.getAllCookies(cb(err, cookies))`
-
-_Optional_. Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure.
-
-Cookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail.
-
-Pass an error if retrieval fails.
-
-**Note**: not all Stores can implement this due to technical limitations, so it is optional.
-
-## MemoryCookieStore
-
-Inherits from `Store`.
-
-A just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. Supports serialization, `getAllCookies`, and `removeAllCookies`.
-
-## Community Cookie Stores
-
-These are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look:
-
-- [`db-cookie-store`](https://github.com/JSBizon/db-cookie-store): SQL including SQLite-based databases
-- [`file-cookie-store`](https://github.com/JSBizon/file-cookie-store): Netscape cookie file format on disk
-- [`redis-cookie-store`](https://github.com/benkroeger/redis-cookie-store): Redis
-- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk
-- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage
-
-
-# Serialization Format
-
-**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.
-
-```js
- {
- // The version of tough-cookie that serialized this jar.
- version: 'tough-cookie@1.x.y',
-
- // add the store type, to make humans happy:
- storeType: 'MemoryCookieStore',
-
- // CookieJar configuration:
- rejectPublicSuffixes: true,
- // ... future items go here
-
- // Gets filled from jar.store.getAllCookies():
- cookies: [
- {
- key: 'string',
- value: 'string',
- // ...
- /* other Cookie.serializableProperties go here */
- }
- ]
- }
-```
-
-# Copyright and License
-
-BSD-3-Clause:
-
-```text
- Copyright (c) 2015, Salesforce.com, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. Neither the name of Salesforce.com nor the names of its contributors may
- be used to endorse or promote products derived from this software without
- specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-```
diff --git a/node_modules/tough-cookie/lib/cookie.js b/node_modules/tough-cookie/lib/cookie.js
deleted file mode 100644
index 2ab6f092d..000000000
--- a/node_modules/tough-cookie/lib/cookie.js
+++ /dev/null
@@ -1,1488 +0,0 @@
-/*!
- * Copyright (c) 2015, Salesforce.com, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-'use strict';
-var urlParse = require('url').parse;
-var util = require('util');
-var ipRegex = require('ip-regex')({ exact: true });
-var pubsuffix = require('./pubsuffix-psl');
-var Store = require('./store').Store;
-var MemoryCookieStore = require('./memstore').MemoryCookieStore;
-var pathMatch = require('./pathMatch').pathMatch;
-var VERSION = require('./version');
-
-var punycode;
-try {
- punycode = require('punycode');
-} catch(e) {
- console.warn("tough-cookie: can't load punycode; won't use punycode for domain normalization");
-}
-
-// From RFC6265 S4.1.1
-// note that it excludes \x3B ";"
-var COOKIE_OCTETS = /^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/;
-
-var CONTROL_CHARS = /[\x00-\x1F]/;
-
-// From Chromium // '\r', '\n' and '\0' should be treated as a terminator in
-// the "relaxed" mode, see:
-// https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/parsed_cookie.cc#L60
-var TERMINATORS = ['\n', '\r', '\0'];
-
-// RFC6265 S4.1.1 defines path value as 'any CHAR except CTLs or ";"'
-// Note ';' is \x3B
-var PATH_VALUE = /[\x20-\x3A\x3C-\x7E]+/;
-
-// date-time parsing constants (RFC6265 S5.1.1)
-
-var DATE_DELIM = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/;
-
-var MONTH_TO_NUM = {
- jan:0, feb:1, mar:2, apr:3, may:4, jun:5,
- jul:6, aug:7, sep:8, oct:9, nov:10, dec:11
-};
-var NUM_TO_MONTH = [
- 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'
-];
-var NUM_TO_DAY = [
- 'Sun','Mon','Tue','Wed','Thu','Fri','Sat'
-];
-
-var MAX_TIME = 2147483647000; // 31-bit max
-var MIN_TIME = 0; // 31-bit min
-
-/*
- * Parses a Natural number (i.e., non-negative integer) with either the
- * <min>*<max>DIGIT ( non-digit *OCTET )
- * or
- * <min>*<max>DIGIT
- * grammar (RFC6265 S5.1.1).
- *
- * The "trailingOK" boolean controls if the grammar accepts a
- * "( non-digit *OCTET )" trailer.
- */
-function parseDigits(token, minDigits, maxDigits, trailingOK) {
- var count = 0;
- while (count < token.length) {
- var c = token.charCodeAt(count);
- // "non-digit = %x00-2F / %x3A-FF"
- if (c <= 0x2F || c >= 0x3A) {
- break;
- }
- count++;
- }
-
- // constrain to a minimum and maximum number of digits.
- if (count < minDigits || count > maxDigits) {
- return null;
- }
-
- if (!trailingOK && count != token.length) {
- return null;
- }
-
- return parseInt(token.substr(0,count), 10);
-}
-
-function parseTime(token) {
- var parts = token.split(':');
- var result = [0,0,0];
-
- /* RF6256 S5.1.1:
- * time = hms-time ( non-digit *OCTET )
- * hms-time = time-field ":" time-field ":" time-field
- * time-field = 1*2DIGIT
- */
-
- if (parts.length !== 3) {
- return null;
- }
-
- for (var i = 0; i < 3; i++) {
- // "time-field" must be strictly "1*2DIGIT", HOWEVER, "hms-time" can be
- // followed by "( non-digit *OCTET )" so therefore the last time-field can
- // have a trailer
- var trailingOK = (i == 2);
- var num = parseDigits(parts[i], 1, 2, trailingOK);
- if (num === null) {
- return null;
- }
- result[i] = num;
- }
-
- return result;
-}
-
-function parseMonth(token) {
- token = String(token).substr(0,3).toLowerCase();
- var num = MONTH_TO_NUM[token];
- return num >= 0 ? num : null;
-}
-
-/*
- * RFC6265 S5.1.1 date parser (see RFC for full grammar)
- */
-function parseDate(str) {
- if (!str) {
- return;
- }
-
- /* RFC6265 S5.1.1:
- * 2. Process each date-token sequentially in the order the date-tokens
- * appear in the cookie-date
- */
- var tokens = str.split(DATE_DELIM);
- if (!tokens) {
- return;
- }
-
- var hour = null;
- var minute = null;
- var second = null;
- var dayOfMonth = null;
- var month = null;
- var year = null;
-
- for (var i=0; i<tokens.length; i++) {
- var token = tokens[i].trim();
- if (!token.length) {
- continue;
- }
-
- var result;
-
- /* 2.1. If the found-time flag is not set and the token matches the time
- * production, set the found-time flag and set the hour- value,
- * minute-value, and second-value to the numbers denoted by the digits in
- * the date-token, respectively. Skip the remaining sub-steps and continue
- * to the next date-token.
- */
- if (second === null) {
- result = parseTime(token);
- if (result) {
- hour = result[0];
- minute = result[1];
- second = result[2];
- continue;
- }
- }
-
- /* 2.2. If the found-day-of-month flag is not set and the date-token matches
- * the day-of-month production, set the found-day-of- month flag and set
- * the day-of-month-value to the number denoted by the date-token. Skip
- * the remaining sub-steps and continue to the next date-token.
- */
- if (dayOfMonth === null) {
- // "day-of-month = 1*2DIGIT ( non-digit *OCTET )"
- result = parseDigits(token, 1, 2, true);
- if (result !== null) {
- dayOfMonth = result;
- continue;
- }
- }
-
- /* 2.3. If the found-month flag is not set and the date-token matches the
- * month production, set the found-month flag and set the month-value to
- * the month denoted by the date-token. Skip the remaining sub-steps and
- * continue to the next date-token.
- */
- if (month === null) {
- result = parseMonth(token);
- if (result !== null) {
- month = result;
- continue;
- }
- }
-
- /* 2.4. If the found-year flag is not set and the date-token matches the
- * year production, set the found-year flag and set the year-value to the
- * number denoted by the date-token. Skip the remaining sub-steps and
- * continue to the next date-token.
- */
- if (year === null) {
- // "year = 2*4DIGIT ( non-digit *OCTET )"
- result = parseDigits(token, 2, 4, true);
- if (result !== null) {
- year = result;
- /* From S5.1.1:
- * 3. If the year-value is greater than or equal to 70 and less
- * than or equal to 99, increment the year-value by 1900.
- * 4. If the year-value is greater than or equal to 0 and less
- * than or equal to 69, increment the year-value by 2000.
- */
- if (year >= 70 && year <= 99) {
- year += 1900;
- } else if (year >= 0 && year <= 69) {
- year += 2000;
- }
- }
- }
- }
-
- /* RFC 6265 S5.1.1
- * "5. Abort these steps and fail to parse the cookie-date if:
- * * at least one of the found-day-of-month, found-month, found-
- * year, or found-time flags is not set,
- * * the day-of-month-value is less than 1 or greater than 31,
- * * the year-value is less than 1601,
- * * the hour-value is greater than 23,
- * * the minute-value is greater than 59, or
- * * the second-value is greater than 59.
- * (Note that leap seconds cannot be represented in this syntax.)"
- *
- * So, in order as above:
- */
- if (
- dayOfMonth === null || month === null || year === null || second === null ||
- dayOfMonth < 1 || dayOfMonth > 31 ||
- year < 1601 ||
- hour > 23 ||
- minute > 59 ||
- second > 59
- ) {
- return;
- }
-
- return new Date(Date.UTC(year, month, dayOfMonth, hour, minute, second));
-}
-
-function formatDate(date) {
- var d = date.getUTCDate(); d = d >= 10 ? d : '0'+d;
- var h = date.getUTCHours(); h = h >= 10 ? h : '0'+h;
- var m = date.getUTCMinutes(); m = m >= 10 ? m : '0'+m;
- var s = date.getUTCSeconds(); s = s >= 10 ? s : '0'+s;
- return NUM_TO_DAY[date.getUTCDay()] + ', ' +
- d+' '+ NUM_TO_MONTH[date.getUTCMonth()] +' '+ date.getUTCFullYear() +' '+
- h+':'+m+':'+s+' GMT';
-}
-
-// S5.1.2 Canonicalized Host Names
-function canonicalDomain(str) {
- if (str == null) {
- return null;
- }
- str = str.trim().replace(/^\./,''); // S4.1.2.3 & S5.2.3: ignore leading .
-
- // convert to IDN if any non-ASCII characters
- if (punycode && /[^\u0001-\u007f]/.test(str)) {
- str = punycode.toASCII(str);
- }
-
- return str.toLowerCase();
-}
-
-// S5.1.3 Domain Matching
-function domainMatch(str, domStr, canonicalize) {
- if (str == null || domStr == null) {
- return null;
- }
- if (canonicalize !== false) {
- str = canonicalDomain(str);
- domStr = canonicalDomain(domStr);
- }
-
- /*
- * "The domain string and the string are identical. (Note that both the
- * domain string and the string will have been canonicalized to lower case at
- * this point)"
- */
- if (str == domStr) {
- return true;
- }
-
- /* "All of the following [three] conditions hold:" (order adjusted from the RFC) */
-
- /* "* The string is a host name (i.e., not an IP address)." */
- if (ipRegex.test(str)) {
- return false;
- }
-
- /* "* The domain string is a suffix of the string" */
- var idx = str.indexOf(domStr);
- if (idx <= 0) {
- return false; // it's a non-match (-1) or prefix (0)
- }
-
- // e.g "a.b.c".indexOf("b.c") === 2
- // 5 === 3+2
- if (str.length !== domStr.length + idx) { // it's not a suffix
- return false;
- }
-
- /* "* The last character of the string that is not included in the domain
- * string is a %x2E (".") character." */
- if (str.substr(idx-1,1) !== '.') {
- return false;
- }
-
- return true;
-}
-
-
-// RFC6265 S5.1.4 Paths and Path-Match
-
-/*
- * "The user agent MUST use an algorithm equivalent to the following algorithm
- * to compute the default-path of a cookie:"
- *
- * Assumption: the path (and not query part or absolute uri) is passed in.
- */
-function defaultPath(path) {
- // "2. If the uri-path is empty or if the first character of the uri-path is not
- // a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
- if (!path || path.substr(0,1) !== "/") {
- return "/";
- }
-
- // "3. If the uri-path contains no more than one %x2F ("/") character, output
- // %x2F ("/") and skip the remaining step."
- if (path === "/") {
- return path;
- }
-
- var rightSlash = path.lastIndexOf("/");
- if (rightSlash === 0) {
- return "/";
- }
-
- // "4. Output the characters of the uri-path from the first character up to,
- // but not including, the right-most %x2F ("/")."
- return path.slice(0, rightSlash);
-}
-
-function trimTerminator(str) {
- for (var t = 0; t < TERMINATORS.length; t++) {
- var terminatorIdx = str.indexOf(TERMINATORS[t]);
- if (terminatorIdx !== -1) {
- str = str.substr(0,terminatorIdx);
- }
- }
-
- return str;
-}
-
-function parseCookiePair(cookiePair, looseMode) {
- cookiePair = trimTerminator(cookiePair);
-
- var firstEq = cookiePair.indexOf('=');
- if (looseMode) {
- if (firstEq === 0) { // '=' is immediately at start
- cookiePair = cookiePair.substr(1);
- firstEq = cookiePair.indexOf('='); // might still need to split on '='
- }
- } else { // non-loose mode
- if (firstEq <= 0) { // no '=' or is at start
- return; // needs to have non-empty "cookie-name"
- }
- }
-
- var cookieName, cookieValue;
- if (firstEq <= 0) {
- cookieName = "";
- cookieValue = cookiePair.trim();
- } else {
- cookieName = cookiePair.substr(0, firstEq).trim();
- cookieValue = cookiePair.substr(firstEq+1).trim();
- }
-
- if (CONTROL_CHARS.test(cookieName) || CONTROL_CHARS.test(cookieValue)) {
- return;
- }
-
- var c = new Cookie();
- c.key = cookieName;
- c.value = cookieValue;
- return c;
-}
-
-function parse(str, options) {
- if (!options || typeof options !== 'object') {
- options = {};
- }
- str = str.trim();
-
- // We use a regex to parse the "name-value-pair" part of S5.2
- var firstSemi = str.indexOf(';'); // S5.2 step 1
- var cookiePair = (firstSemi === -1) ? str : str.substr(0, firstSemi);
- var c = parseCookiePair(cookiePair, !!options.loose);
- if (!c) {
- return;
- }
-
- if (firstSemi === -1) {
- return c;
- }
-
- // S5.2.3 "unparsed-attributes consist of the remainder of the set-cookie-string
- // (including the %x3B (";") in question)." plus later on in the same section
- // "discard the first ";" and trim".
- var unparsed = str.slice(firstSemi + 1).trim();
-
- // "If the unparsed-attributes string is empty, skip the rest of these
- // steps."
- if (unparsed.length === 0) {
- return c;
- }
-
- /*
- * S5.2 says that when looping over the items "[p]rocess the attribute-name
- * and attribute-value according to the requirements in the following
- * subsections" for every item. Plus, for many of the individual attributes
- * in S5.3 it says to use the "attribute-value of the last attribute in the
- * cookie-attribute-list". Therefore, in this implementation, we overwrite
- * the previous value.
- */
- var cookie_avs = unparsed.split(';');
- while (cookie_avs.length) {
- var av = cookie_avs.shift().trim();
- if (av.length === 0) { // happens if ";;" appears
- continue;
- }
- var av_sep = av.indexOf('=');
- var av_key, av_value;
-
- if (av_sep === -1) {
- av_key = av;
- av_value = null;
- } else {
- av_key = av.substr(0,av_sep);
- av_value = av.substr(av_sep+1);
- }
-
- av_key = av_key.trim().toLowerCase();
-
- if (av_value) {
- av_value = av_value.trim();
- }
-
- switch(av_key) {
- case 'expires': // S5.2.1
- if (av_value) {
- var exp = parseDate(av_value);
- // "If the attribute-value failed to parse as a cookie date, ignore the
- // cookie-av."
- if (exp) {
- // over and underflow not realistically a concern: V8's getTime() seems to
- // store something larger than a 32-bit time_t (even with 32-bit node)
- c.expires = exp;
- }
- }
- break;
-
- case 'max-age': // S5.2.2
- if (av_value) {
- // "If the first character of the attribute-value is not a DIGIT or a "-"
- // character ...[or]... If the remainder of attribute-value contains a
- // non-DIGIT character, ignore the cookie-av."
- if (/^-?[0-9]+$/.test(av_value)) {
- var delta = parseInt(av_value, 10);
- // "If delta-seconds is less than or equal to zero (0), let expiry-time
- // be the earliest representable date and time."
- c.setMaxAge(delta);
- }
- }
- break;
-
- case 'domain': // S5.2.3
- // "If the attribute-value is empty, the behavior is undefined. However,
- // the user agent SHOULD ignore the cookie-av entirely."
- if (av_value) {
- // S5.2.3 "Let cookie-domain be the attribute-value without the leading %x2E
- // (".") character."
- var domain = av_value.trim().replace(/^\./, '');
- if (domain) {
- // "Convert the cookie-domain to lower case."
- c.domain = domain.toLowerCase();
- }
- }
- break;
-
- case 'path': // S5.2.4
- /*
- * "If the attribute-value is empty or if the first character of the
- * attribute-value is not %x2F ("/"):
- * Let cookie-path be the default-path.
- * Otherwise:
- * Let cookie-path be the attribute-value."
- *
- * We'll represent the default-path as null since it depends on the
- * context of the parsing.
- */
- c.path = av_value && av_value[0] === "/" ? av_value : null;
- break;
-
- case 'secure': // S5.2.5
- /*
- * "If the attribute-name case-insensitively matches the string "Secure",
- * the user agent MUST append an attribute to the cookie-attribute-list
- * with an attribute-name of Secure and an empty attribute-value."
- */
- c.secure = true;
- break;
-
- case 'httponly': // S5.2.6 -- effectively the same as 'secure'
- c.httpOnly = true;
- break;
-
- default:
- c.extensions = c.extensions || [];
- c.extensions.push(av);
- break;
- }
- }
-
- return c;
-}
-
-// avoid the V8 deoptimization monster!
-function jsonParse(str) {
- var obj;
- try {
- obj = JSON.parse(str);
- } catch (e) {
- return e;
- }
- return obj;
-}
-
-function fromJSON(str) {
- if (!str) {
- return null;
- }
-
- var obj;
- if (typeof str === 'string') {
- obj = jsonParse(str);
- if (obj instanceof Error) {
- return null;
- }
- } else {
- // assume it's an Object
- obj = str;
- }
-
- var c = new Cookie();
- for (var i=0; i<Cookie.serializableProperties.length; i++) {
- var prop = Cookie.serializableProperties[i];
- if (obj[prop] === undefined ||
- obj[prop] === Cookie.prototype[prop])
- {
- continue; // leave as prototype default
- }
-
- if (prop === 'expires' ||
- prop === 'creation' ||
- prop === 'lastAccessed')
- {
- if (obj[prop] === null) {
- c[prop] = null;
- } else {
- c[prop] = obj[prop] == "Infinity" ?
- "Infinity" : new Date(obj[prop]);
- }
- } else {
- c[prop] = obj[prop];
- }
- }
-
- return c;
-}
-
-/* Section 5.4 part 2:
- * "* Cookies with longer paths are listed before cookies with
- * shorter paths.
- *
- * * Among cookies that have equal-length path fields, cookies with
- * earlier creation-times are listed before cookies with later
- * creation-times."
- */
-
-function cookieCompare(a,b) {
- var cmp = 0;
-
- // descending for length: b CMP a
- var aPathLen = a.path ? a.path.length : 0;
- var bPathLen = b.path ? b.path.length : 0;
- cmp = bPathLen - aPathLen;
- if (cmp !== 0) {
- return cmp;
- }
-
- // ascending for time: a CMP b
- var aTime = a.creation ? a.creation.getTime() : MAX_TIME;
- var bTime = b.creation ? b.creation.getTime() : MAX_TIME;
- cmp = aTime - bTime;
- if (cmp !== 0) {
- return cmp;
- }
-
- // break ties for the same millisecond (precision of JavaScript's clock)
- cmp = a.creationIndex - b.creationIndex;
-
- return cmp;
-}
-
-// Gives the permutation of all possible pathMatch()es of a given path. The
-// array is in longest-to-shortest order. Handy for indexing.
-function permutePath(path) {
- if (path === '/') {
- return ['/'];
- }
- if (path.lastIndexOf('/') === path.length-1) {
- path = path.substr(0,path.length-1);
- }
- var permutations = [path];
- while (path.length > 1) {
- var lindex = path.lastIndexOf('/');
- if (lindex === 0) {
- break;
- }
- path = path.substr(0,lindex);
- permutations.push(path);
- }
- permutations.push('/');
- return permutations;
-}
-
-function getCookieContext(url) {
- if (url instanceof Object) {
- return url;
- }
- // NOTE: decodeURI will throw on malformed URIs (see GH-32).
- // Therefore, we will just skip decoding for such URIs.
- try {
- url = decodeURI(url);
- }
- catch(err) {
- // Silently swallow error
- }
-
- return urlParse(url);
-}
-
-function Cookie(options) {
- options = options || {};
-
- Object.keys(options).forEach(function(prop) {
- if (Cookie.prototype.hasOwnProperty(prop) &&
- Cookie.prototype[prop] !== options[prop] &&
- prop.substr(0,1) !== '_')
- {
- this[prop] = options[prop];
- }
- }, this);
-
- this.creation = this.creation || new Date();
-
- // used to break creation ties in cookieCompare():
- Object.defineProperty(this, 'creationIndex', {
- configurable: false,
- enumerable: false, // important for assert.deepEqual checks
- writable: true,
- value: ++Cookie.cookiesCreated
- });
-}
-
-Cookie.cookiesCreated = 0; // incremented each time a cookie is created
-
-Cookie.parse = parse;
-Cookie.fromJSON = fromJSON;
-
-Cookie.prototype.key = "";
-Cookie.prototype.value = "";
-
-// the order in which the RFC has them:
-Cookie.prototype.expires = "Infinity"; // coerces to literal Infinity
-Cookie.prototype.maxAge = null; // takes precedence over expires for TTL
-Cookie.prototype.domain = null;
-Cookie.prototype.path = null;
-Cookie.prototype.secure = false;
-Cookie.prototype.httpOnly = false;
-Cookie.prototype.extensions = null;
-
-// set by the CookieJar:
-Cookie.prototype.hostOnly = null; // boolean when set
-Cookie.prototype.pathIsDefault = null; // boolean when set
-Cookie.prototype.creation = null; // Date when set; defaulted by Cookie.parse
-Cookie.prototype.lastAccessed = null; // Date when set
-Object.defineProperty(Cookie.prototype, 'creationIndex', {
- configurable: true,
- enumerable: false,
- writable: true,
- value: 0
-});
-
-Cookie.serializableProperties = Object.keys(Cookie.prototype)
- .filter(function(prop) {
- return !(
- Cookie.prototype[prop] instanceof Function ||
- prop === 'creationIndex' ||
- prop.substr(0,1) === '_'
- );
- });
-
-Cookie.prototype.inspect = function inspect() {
- var now = Date.now();
- return 'Cookie="'+this.toString() +
- '; hostOnly='+(this.hostOnly != null ? this.hostOnly : '?') +
- '; aAge='+(this.lastAccessed ? (now-this.lastAccessed.getTime())+'ms' : '?') +
- '; cAge='+(this.creation ? (now-this.creation.getTime())+'ms' : '?') +
- '"';
-};
-
-// Use the new custom inspection symbol to add the custom inspect function if
-// available.
-if (util.inspect.custom) {
- Cookie.prototype[util.inspect.custom] = Cookie.prototype.inspect;
-}
-
-Cookie.prototype.toJSON = function() {
- var obj = {};
-
- var props = Cookie.serializableProperties;
- for (var i=0; i<props.length; i++) {
- var prop = props[i];
- if (this[prop] === Cookie.prototype[prop]) {
- continue; // leave as prototype default
- }
-
- if (prop === 'expires' ||
- prop === 'creation' ||
- prop === 'lastAccessed')
- {
- if (this[prop] === null) {
- obj[prop] = null;
- } else {
- obj[prop] = this[prop] == "Infinity" ? // intentionally not ===
- "Infinity" : this[prop].toISOString();
- }
- } else if (prop === 'maxAge') {
- if (this[prop] !== null) {
- // again, intentionally not ===
- obj[prop] = (this[prop] == Infinity || this[prop] == -Infinity) ?
- this[prop].toString() : this[prop];
- }
- } else {
- if (this[prop] !== Cookie.prototype[prop]) {
- obj[prop] = this[prop];
- }
- }
- }
-
- return obj;
-};
-
-Cookie.prototype.clone = function() {
- return fromJSON(this.toJSON());
-};
-
-Cookie.prototype.validate = function validate() {
- if (!COOKIE_OCTETS.test(this.value)) {
- return false;
- }
- if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires)) {
- return false;
- }
- if (this.maxAge != null && this.maxAge <= 0) {
- return false; // "Max-Age=" non-zero-digit *DIGIT
- }
- if (this.path != null && !PATH_VALUE.test(this.path)) {
- return false;
- }
-
- var cdomain = this.cdomain();
- if (cdomain) {
- if (cdomain.match(/\.$/)) {
- return false; // S4.1.2.3 suggests that this is bad. domainMatch() tests confirm this
- }
- var suffix = pubsuffix.getPublicSuffix(cdomain);
- if (suffix == null) { // it's a public suffix
- return false;
- }
- }
- return true;
-};
-
-Cookie.prototype.setExpires = function setExpires(exp) {
- if (exp instanceof Date) {
- this.expires = exp;
- } else {
- this.expires = parseDate(exp) || "Infinity";
- }
-};
-
-Cookie.prototype.setMaxAge = function setMaxAge(age) {
- if (age === Infinity || age === -Infinity) {
- this.maxAge = age.toString(); // so JSON.stringify() works
- } else {
- this.maxAge = age;
- }
-};
-
-// gives Cookie header format
-Cookie.prototype.cookieString = function cookieString() {
- var val = this.value;
- if (val == null) {
- val = '';
- }
- if (this.key === '') {
- return val;
- }
- return this.key+'='+val;
-};
-
-// gives Set-Cookie header format
-Cookie.prototype.toString = function toString() {
- var str = this.cookieString();
-
- if (this.expires != Infinity) {
- if (this.expires instanceof Date) {
- str += '; Expires='+formatDate(this.expires);
- } else {
- str += '; Expires='+this.expires;
- }
- }
-
- if (this.maxAge != null && this.maxAge != Infinity) {
- str += '; Max-Age='+this.maxAge;
- }
-
- if (this.domain && !this.hostOnly) {
- str += '; Domain='+this.domain;
- }
- if (this.path) {
- str += '; Path='+this.path;
- }
-
- if (this.secure) {
- str += '; Secure';
- }
- if (this.httpOnly) {
- str += '; HttpOnly';
- }
- if (this.extensions) {
- this.extensions.forEach(function(ext) {
- str += '; '+ext;
- });
- }
-
- return str;
-};
-
-// TTL() partially replaces the "expiry-time" parts of S5.3 step 3 (setCookie()
-// elsewhere)
-// S5.3 says to give the "latest representable date" for which we use Infinity
-// For "expired" we use 0
-Cookie.prototype.TTL = function TTL(now) {
- /* RFC6265 S4.1.2.2 If a cookie has both the Max-Age and the Expires
- * attribute, the Max-Age attribute has precedence and controls the
- * expiration date of the cookie.
- * (Concurs with S5.3 step 3)
- */
- if (this.maxAge != null) {
- return this.maxAge<=0 ? 0 : this.maxAge*1000;
- }
-
- var expires = this.expires;
- if (expires != Infinity) {
- if (!(expires instanceof Date)) {
- expires = parseDate(expires) || Infinity;
- }
-
- if (expires == Infinity) {
- return Infinity;
- }
-
- return expires.getTime() - (now || Date.now());
- }
-
- return Infinity;
-};
-
-// expiryTime() replaces the "expiry-time" parts of S5.3 step 3 (setCookie()
-// elsewhere)
-Cookie.prototype.expiryTime = function expiryTime(now) {
- if (this.maxAge != null) {
- var relativeTo = now || this.creation || new Date();
- var age = (this.maxAge <= 0) ? -Infinity : this.maxAge*1000;
- return relativeTo.getTime() + age;
- }
-
- if (this.expires == Infinity) {
- return Infinity;
- }
- return this.expires.getTime();
-};
-
-// expiryDate() replaces the "expiry-time" parts of S5.3 step 3 (setCookie()
-// elsewhere), except it returns a Date
-Cookie.prototype.expiryDate = function expiryDate(now) {
- var millisec = this.expiryTime(now);
- if (millisec == Infinity) {
- return new Date(MAX_TIME);
- } else if (millisec == -Infinity) {
- return new Date(MIN_TIME);
- } else {
- return new Date(millisec);
- }
-};
-
-// This replaces the "persistent-flag" parts of S5.3 step 3
-Cookie.prototype.isPersistent = function isPersistent() {
- return (this.maxAge != null || this.expires != Infinity);
-};
-
-// Mostly S5.1.2 and S5.2.3:
-Cookie.prototype.cdomain =
-Cookie.prototype.canonicalizedDomain = function canonicalizedDomain() {
- if (this.domain == null) {
- return null;
- }
- return canonicalDomain(this.domain);
-};
-
-function CookieJar(store, options) {
- if (typeof options === "boolean") {
- options = {rejectPublicSuffixes: options};
- } else if (options == null) {
- options = {};
- }
- if (options.rejectPublicSuffixes != null) {
- this.rejectPublicSuffixes = options.rejectPublicSuffixes;
- }
- if (options.looseMode != null) {
- this.enableLooseMode = options.looseMode;
- }
-
- if (!store) {
- store = new MemoryCookieStore();
- }
- this.store = store;
-}
-CookieJar.prototype.store = null;
-CookieJar.prototype.rejectPublicSuffixes = true;
-CookieJar.prototype.enableLooseMode = false;
-var CAN_BE_SYNC = [];
-
-CAN_BE_SYNC.push('setCookie');
-CookieJar.prototype.setCookie = function(cookie, url, options, cb) {
- var err;
- var context = getCookieContext(url);
- if (options instanceof Function) {
- cb = options;
- options = {};
- }
-
- var host = canonicalDomain(context.hostname);
- var loose = this.enableLooseMode;
- if (options.loose != null) {
- loose = options.loose;
- }
-
- // S5.3 step 1
- if (typeof(cookie) === 'string' || cookie instanceof String) {
- cookie = Cookie.parse(cookie, { loose: loose });
- if (!cookie) {
- err = new Error("Cookie failed to parse");
- return cb(options.ignoreError ? null : err);
- }
- }
- else if (!(cookie instanceof Cookie)) {
- // If you're seeing this error, and are passing in a Cookie object,
- // it *might* be a Cookie object from another loaded version of tough-cookie.
- err = new Error("First argument to setCookie must be a Cookie object or string");
- return cb(options.ignoreError ? null : err);
- }
-
- // S5.3 step 2
- var now = options.now || new Date(); // will assign later to save effort in the face of errors
-
- // S5.3 step 3: NOOP; persistent-flag and expiry-time is handled by getCookie()
-
- // S5.3 step 4: NOOP; domain is null by default
-
- // S5.3 step 5: public suffixes
- if (this.rejectPublicSuffixes && cookie.domain) {
- var suffix = pubsuffix.getPublicSuffix(cookie.cdomain());
- if (suffix == null) { // e.g. "com"
- err = new Error("Cookie has domain set to a public suffix");
- return cb(options.ignoreError ? null : err);
- }
- }
-
- // S5.3 step 6:
- if (cookie.domain) {
- if (!domainMatch(host, cookie.cdomain(), false)) {
- err = new Error("Cookie not in this host's domain. Cookie:"+cookie.cdomain()+" Request:"+host);
- return cb(options.ignoreError ? null : err);
- }
-
- if (cookie.hostOnly == null) { // don't reset if already set
- cookie.hostOnly = false;
- }
-
- } else {
- cookie.hostOnly = true;
- cookie.domain = host;
- }
-
- //S5.2.4 If the attribute-value is empty or if the first character of the
- //attribute-value is not %x2F ("/"):
- //Let cookie-path be the default-path.
- if (!cookie.path || cookie.path[0] !== '/') {
- cookie.path = defaultPath(context.pathname);
- cookie.pathIsDefault = true;
- }
-
- // S5.3 step 8: NOOP; secure attribute
- // S5.3 step 9: NOOP; httpOnly attribute
-
- // S5.3 step 10
- if (options.http === false && cookie.httpOnly) {
- err = new Error("Cookie is HttpOnly and this isn't an HTTP API");
- return cb(options.ignoreError ? null : err);
- }
-
- var store = this.store;
-
- if (!store.updateCookie) {
- store.updateCookie = function(oldCookie, newCookie, cb) {
- this.putCookie(newCookie, cb);
- };
- }
-
- function withCookie(err, oldCookie) {
- if (err) {
- return cb(err);
- }
-
- var next = function(err) {
- if (err) {
- return cb(err);
- } else {
- cb(null, cookie);
- }
- };
-
- if (oldCookie) {
- // S5.3 step 11 - "If the cookie store contains a cookie with the same name,
- // domain, and path as the newly created cookie:"
- if (options.http === false && oldCookie.httpOnly) { // step 11.2
- err = new Error("old Cookie is HttpOnly and this isn't an HTTP API");
- return cb(options.ignoreError ? null : err);
- }
- cookie.creation = oldCookie.creation; // step 11.3
- cookie.creationIndex = oldCookie.creationIndex; // preserve tie-breaker
- cookie.lastAccessed = now;
- // Step 11.4 (delete cookie) is implied by just setting the new one:
- store.updateCookie(oldCookie, cookie, next); // step 12
-
- } else {
- cookie.creation = cookie.lastAccessed = now;
- store.putCookie(cookie, next); // step 12
- }
- }
-
- store.findCookie(cookie.domain, cookie.path, cookie.key, withCookie);
-};
-
-// RFC6365 S5.4
-CAN_BE_SYNC.push('getCookies');
-CookieJar.prototype.getCookies = function(url, options, cb) {
- var context = getCookieContext(url);
- if (options instanceof Function) {
- cb = options;
- options = {};
- }
-
- var host = canonicalDomain(context.hostname);
- var path = context.pathname || '/';
-
- var secure = options.secure;
- if (secure == null && context.protocol &&
- (context.protocol == 'https:' || context.protocol == 'wss:'))
- {
- secure = true;
- }
-
- var http = options.http;
- if (http == null) {
- http = true;
- }
-
- var now = options.now || Date.now();
- var expireCheck = options.expire !== false;
- var allPaths = !!options.allPaths;
- var store = this.store;
-
- function matchingCookie(c) {
- // "Either:
- // The cookie's host-only-flag is true and the canonicalized
- // request-host is identical to the cookie's domain.
- // Or:
- // The cookie's host-only-flag is false and the canonicalized
- // request-host domain-matches the cookie's domain."
- if (c.hostOnly) {
- if (c.domain != host) {
- return false;
- }
- } else {
- if (!domainMatch(host, c.domain, false)) {
- return false;
- }
- }
-
- // "The request-uri's path path-matches the cookie's path."
- if (!allPaths && !pathMatch(path, c.path)) {
- return false;
- }
-
- // "If the cookie's secure-only-flag is true, then the request-uri's
- // scheme must denote a "secure" protocol"
- if (c.secure && !secure) {
- return false;
- }
-
- // "If the cookie's http-only-flag is true, then exclude the cookie if the
- // cookie-string is being generated for a "non-HTTP" API"
- if (c.httpOnly && !http) {
- return false;
- }
-
- // deferred from S5.3
- // non-RFC: allow retention of expired cookies by choice
- if (expireCheck && c.expiryTime() <= now) {
- store.removeCookie(c.domain, c.path, c.key, function(){}); // result ignored
- return false;
- }
-
- return true;
- }
-
- store.findCookies(host, allPaths ? null : path, function(err,cookies) {
- if (err) {
- return cb(err);
- }
-
- cookies = cookies.filter(matchingCookie);
-
- // sorting of S5.4 part 2
- if (options.sort !== false) {
- cookies = cookies.sort(cookieCompare);
- }
-
- // S5.4 part 3
- var now = new Date();
- cookies.forEach(function(c) {
- c.lastAccessed = now;
- });
- // TODO persist lastAccessed
-
- cb(null,cookies);
- });
-};
-
-CAN_BE_SYNC.push('getCookieString');
-CookieJar.prototype.getCookieString = function(/*..., cb*/) {
- var args = Array.prototype.slice.call(arguments,0);
- var cb = args.pop();
- var next = function(err,cookies) {
- if (err) {
- cb(err);
- } else {
- cb(null, cookies
- .sort(cookieCompare)
- .map(function(c){
- return c.cookieString();
- })
- .join('; '));
- }
- };
- args.push(next);
- this.getCookies.apply(this,args);
-};
-
-CAN_BE_SYNC.push('getSetCookieStrings');
-CookieJar.prototype.getSetCookieStrings = function(/*..., cb*/) {
- var args = Array.prototype.slice.call(arguments,0);
- var cb = args.pop();
- var next = function(err,cookies) {
- if (err) {
- cb(err);
- } else {
- cb(null, cookies.map(function(c){
- return c.toString();
- }));
- }
- };
- args.push(next);
- this.getCookies.apply(this,args);
-};
-
-CAN_BE_SYNC.push('serialize');
-CookieJar.prototype.serialize = function(cb) {
- var type = this.store.constructor.name;
- if (type === 'Object') {
- type = null;
- }
-
- // update README.md "Serialization Format" if you change this, please!
- var serialized = {
- // The version of tough-cookie that serialized this jar. Generally a good
- // practice since future versions can make data import decisions based on
- // known past behavior. When/if this matters, use `semver`.
- version: 'tough-cookie@'+VERSION,
-
- // add the store type, to make humans happy:
- storeType: type,
-
- // CookieJar configuration:
- rejectPublicSuffixes: !!this.rejectPublicSuffixes,
-
- // this gets filled from getAllCookies:
- cookies: []
- };
-
- if (!(this.store.getAllCookies &&
- typeof this.store.getAllCookies === 'function'))
- {
- return cb(new Error('store does not support getAllCookies and cannot be serialized'));
- }
-
- this.store.getAllCookies(function(err,cookies) {
- if (err) {
- return cb(err);
- }
-
- serialized.cookies = cookies.map(function(cookie) {
- // convert to serialized 'raw' cookies
- cookie = (cookie instanceof Cookie) ? cookie.toJSON() : cookie;
-
- // Remove the index so new ones get assigned during deserialization
- delete cookie.creationIndex;
-
- return cookie;
- });
-
- return cb(null, serialized);
- });
-};
-
-// well-known name that JSON.stringify calls
-CookieJar.prototype.toJSON = function() {
- return this.serializeSync();
-};
-
-// use the class method CookieJar.deserialize instead of calling this directly
-CAN_BE_SYNC.push('_importCookies');
-CookieJar.prototype._importCookies = function(serialized, cb) {
- var jar = this;
- var cookies = serialized.cookies;
- if (!cookies || !Array.isArray(cookies)) {
- return cb(new Error('serialized jar has no cookies array'));
- }
- cookies = cookies.slice(); // do not modify the original
-
- function putNext(err) {
- if (err) {
- return cb(err);
- }
-
- if (!cookies.length) {
- return cb(err, jar);
- }
-
- var cookie;
- try {
- cookie = fromJSON(cookies.shift());
- } catch (e) {
- return cb(e);
- }
-
- if (cookie === null) {
- return putNext(null); // skip this cookie
- }
-
- jar.store.putCookie(cookie, putNext);
- }
-
- putNext();
-};
-
-CookieJar.deserialize = function(strOrObj, store, cb) {
- if (arguments.length !== 3) {
- // store is optional
- cb = store;
- store = null;
- }
-
- var serialized;
- if (typeof strOrObj === 'string') {
- serialized = jsonParse(strOrObj);
- if (serialized instanceof Error) {
- return cb(serialized);
- }
- } else {
- serialized = strOrObj;
- }
-
- var jar = new CookieJar(store, serialized.rejectPublicSuffixes);
- jar._importCookies(serialized, function(err) {
- if (err) {
- return cb(err);
- }
- cb(null, jar);
- });
-};
-
-CookieJar.deserializeSync = function(strOrObj, store) {
- var serialized = typeof strOrObj === 'string' ?
- JSON.parse(strOrObj) : strOrObj;
- var jar = new CookieJar(store, serialized.rejectPublicSuffixes);
-
- // catch this mistake early:
- if (!jar.store.synchronous) {
- throw new Error('CookieJar store is not synchronous; use async API instead.');
- }
-
- jar._importCookiesSync(serialized);
- return jar;
-};
-CookieJar.fromJSON = CookieJar.deserializeSync;
-
-CookieJar.prototype.clone = function(newStore, cb) {
- if (arguments.length === 1) {
- cb = newStore;
- newStore = null;
- }
-
- this.serialize(function(err,serialized) {
- if (err) {
- return cb(err);
- }
- CookieJar.deserialize(serialized, newStore, cb);
- });
-};
-
-CAN_BE_SYNC.push('removeAllCookies');
-CookieJar.prototype.removeAllCookies = function(cb) {
- var store = this.store;
-
- // Check that the store implements its own removeAllCookies(). The default
- // implementation in Store will immediately call the callback with a "not
- // implemented" Error.
- if (store.removeAllCookies instanceof Function &&
- store.removeAllCookies !== Store.prototype.removeAllCookies)
- {
- return store.removeAllCookies(cb);
- }
-
- store.getAllCookies(function(err, cookies) {
- if (err) {
- return cb(err);
- }
-
- if (cookies.length === 0) {
- return cb(null);
- }
-
- var completedCount = 0;
- var removeErrors = [];
-
- function removeCookieCb(removeErr) {
- if (removeErr) {
- removeErrors.push(removeErr);
- }
-
- completedCount++;
-
- if (completedCount === cookies.length) {
- return cb(removeErrors.length ? removeErrors[0] : null);
- }
- }
-
- cookies.forEach(function(cookie) {
- store.removeCookie(cookie.domain, cookie.path, cookie.key, removeCookieCb);
- });
- });
-};
-
-CookieJar.prototype._cloneSync = syncWrap('clone');
-CookieJar.prototype.cloneSync = function(newStore) {
- if (!newStore.synchronous) {
- throw new Error('CookieJar clone destination store is not synchronous; use async API instead.');
- }
- return this._cloneSync(newStore);
-};
-
-// Use a closure to provide a true imperative API for synchronous stores.
-function syncWrap(method) {
- return function() {
- if (!this.store.synchronous) {
- throw new Error('CookieJar store is not synchronous; use async API instead.');
- }
-
- var args = Array.prototype.slice.call(arguments);
- var syncErr, syncResult;
- args.push(function syncCb(err, result) {
- syncErr = err;
- syncResult = result;
- });
- this[method].apply(this, args);
-
- if (syncErr) {
- throw syncErr;
- }
- return syncResult;
- };
-}
-
-// wrap all declared CAN_BE_SYNC methods in the sync wrapper
-CAN_BE_SYNC.forEach(function(method) {
- CookieJar.prototype[method+'Sync'] = syncWrap(method);
-});
-
-exports.version = VERSION;
-exports.CookieJar = CookieJar;
-exports.Cookie = Cookie;
-exports.Store = Store;
-exports.MemoryCookieStore = MemoryCookieStore;
-exports.parseDate = parseDate;
-exports.formatDate = formatDate;
-exports.parse = parse;
-exports.fromJSON = fromJSON;
-exports.domainMatch = domainMatch;
-exports.defaultPath = defaultPath;
-exports.pathMatch = pathMatch;
-exports.getPublicSuffix = pubsuffix.getPublicSuffix;
-exports.cookieCompare = cookieCompare;
-exports.permuteDomain = require('./permuteDomain').permuteDomain;
-exports.permutePath = permutePath;
-exports.canonicalDomain = canonicalDomain;
diff --git a/node_modules/tough-cookie/lib/memstore.js b/node_modules/tough-cookie/lib/memstore.js
deleted file mode 100644
index d2b915c93..000000000
--- a/node_modules/tough-cookie/lib/memstore.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/*!
- * Copyright (c) 2015, Salesforce.com, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-'use strict';
-var Store = require('./store').Store;
-var permuteDomain = require('./permuteDomain').permuteDomain;
-var pathMatch = require('./pathMatch').pathMatch;
-var util = require('util');
-
-function MemoryCookieStore() {
- Store.call(this);
- this.idx = {};
-}
-util.inherits(MemoryCookieStore, Store);
-exports.MemoryCookieStore = MemoryCookieStore;
-MemoryCookieStore.prototype.idx = null;
-
-// Since it's just a struct in RAM, this Store is synchronous
-MemoryCookieStore.prototype.synchronous = true;
-
-// force a default depth:
-MemoryCookieStore.prototype.inspect = function() {
- return "{ idx: "+util.inspect(this.idx, false, 2)+' }';
-};
-
-// Use the new custom inspection symbol to add the custom inspect function if
-// available.
-if (util.inspect.custom) {
- MemoryCookieStore.prototype[util.inspect.custom] = MemoryCookieStore.prototype.inspect;
-}
-
-MemoryCookieStore.prototype.findCookie = function(domain, path, key, cb) {
- if (!this.idx[domain]) {
- return cb(null,undefined);
- }
- if (!this.idx[domain][path]) {
- return cb(null,undefined);
- }
- return cb(null,this.idx[domain][path][key]||null);
-};
-
-MemoryCookieStore.prototype.findCookies = function(domain, path, cb) {
- var results = [];
- if (!domain) {
- return cb(null,[]);
- }
-
- var pathMatcher;
- if (!path) {
- // null means "all paths"
- pathMatcher = function matchAll(domainIndex) {
- for (var curPath in domainIndex) {
- var pathIndex = domainIndex[curPath];
- for (var key in pathIndex) {
- results.push(pathIndex[key]);
- }
- }
- };
-
- } else {
- pathMatcher = function matchRFC(domainIndex) {
- //NOTE: we should use path-match algorithm from S5.1.4 here
- //(see : https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/canonical_cookie.cc#L299)
- Object.keys(domainIndex).forEach(function (cookiePath) {
- if (pathMatch(path, cookiePath)) {
- var pathIndex = domainIndex[cookiePath];
-
- for (var key in pathIndex) {
- results.push(pathIndex[key]);
- }
- }
- });
- };
- }
-
- var domains = permuteDomain(domain) || [domain];
- var idx = this.idx;
- domains.forEach(function(curDomain) {
- var domainIndex = idx[curDomain];
- if (!domainIndex) {
- return;
- }
- pathMatcher(domainIndex);
- });
-
- cb(null,results);
-};
-
-MemoryCookieStore.prototype.putCookie = function(cookie, cb) {
- if (!this.idx[cookie.domain]) {
- this.idx[cookie.domain] = {};
- }
- if (!this.idx[cookie.domain][cookie.path]) {
- this.idx[cookie.domain][cookie.path] = {};
- }
- this.idx[cookie.domain][cookie.path][cookie.key] = cookie;
- cb(null);
-};
-
-MemoryCookieStore.prototype.updateCookie = function(oldCookie, newCookie, cb) {
- // updateCookie() may avoid updating cookies that are identical. For example,
- // lastAccessed may not be important to some stores and an equality
- // comparison could exclude that field.
- this.putCookie(newCookie,cb);
-};
-
-MemoryCookieStore.prototype.removeCookie = function(domain, path, key, cb) {
- if (this.idx[domain] && this.idx[domain][path] && this.idx[domain][path][key]) {
- delete this.idx[domain][path][key];
- }
- cb(null);
-};
-
-MemoryCookieStore.prototype.removeCookies = function(domain, path, cb) {
- if (this.idx[domain]) {
- if (path) {
- delete this.idx[domain][path];
- } else {
- delete this.idx[domain];
- }
- }
- return cb(null);
-};
-
-MemoryCookieStore.prototype.removeAllCookies = function(cb) {
- this.idx = {};
- return cb(null);
-}
-
-MemoryCookieStore.prototype.getAllCookies = function(cb) {
- var cookies = [];
- var idx = this.idx;
-
- var domains = Object.keys(idx);
- domains.forEach(function(domain) {
- var paths = Object.keys(idx[domain]);
- paths.forEach(function(path) {
- var keys = Object.keys(idx[domain][path]);
- keys.forEach(function(key) {
- if (key !== null) {
- cookies.push(idx[domain][path][key]);
- }
- });
- });
- });
-
- // Sort by creationIndex so deserializing retains the creation order.
- // When implementing your own store, this SHOULD retain the order too
- cookies.sort(function(a,b) {
- return (a.creationIndex||0) - (b.creationIndex||0);
- });
-
- cb(null, cookies);
-};
diff --git a/node_modules/tough-cookie/lib/pathMatch.js b/node_modules/tough-cookie/lib/pathMatch.js
deleted file mode 100644
index 7c7a79f1f..000000000
--- a/node_modules/tough-cookie/lib/pathMatch.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*!
- * Copyright (c) 2015, Salesforce.com, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-"use strict";
-/*
- * "A request-path path-matches a given cookie-path if at least one of the
- * following conditions holds:"
- */
-function pathMatch (reqPath, cookiePath) {
- // "o The cookie-path and the request-path are identical."
- if (cookiePath === reqPath) {
- return true;
- }
-
- var idx = reqPath.indexOf(cookiePath);
- if (idx === 0) {
- // "o The cookie-path is a prefix of the request-path, and the last
- // character of the cookie-path is %x2F ("/")."
- if (cookiePath.substr(-1) === "/") {
- return true;
- }
-
- // " o The cookie-path is a prefix of the request-path, and the first
- // character of the request-path that is not included in the cookie- path
- // is a %x2F ("/") character."
- if (reqPath.substr(cookiePath.length, 1) === "/") {
- return true;
- }
- }
-
- return false;
-}
-
-exports.pathMatch = pathMatch;
diff --git a/node_modules/tough-cookie/lib/permuteDomain.js b/node_modules/tough-cookie/lib/permuteDomain.js
deleted file mode 100644
index 91bf44627..000000000
--- a/node_modules/tough-cookie/lib/permuteDomain.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*!
- * Copyright (c) 2015, Salesforce.com, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-"use strict";
-var pubsuffix = require('./pubsuffix-psl');
-
-// Gives the permutation of all possible domainMatch()es of a given domain. The
-// array is in shortest-to-longest order. Handy for indexing.
-function permuteDomain (domain) {
- var pubSuf = pubsuffix.getPublicSuffix(domain);
- if (!pubSuf) {
- return null;
- }
- if (pubSuf == domain) {
- return [domain];
- }
-
- var prefix = domain.slice(0, -(pubSuf.length + 1)); // ".example.com"
- var parts = prefix.split('.').reverse();
- var cur = pubSuf;
- var permutations = [cur];
- while (parts.length) {
- cur = parts.shift() + '.' + cur;
- permutations.push(cur);
- }
- return permutations;
-}
-
-exports.permuteDomain = permuteDomain;
diff --git a/node_modules/tough-cookie/lib/pubsuffix-psl.js b/node_modules/tough-cookie/lib/pubsuffix-psl.js
deleted file mode 100644
index c88329f88..000000000
--- a/node_modules/tough-cookie/lib/pubsuffix-psl.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*!
- * Copyright (c) 2018, Salesforce.com, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-'use strict';
-var psl = require('psl');
-
-function getPublicSuffix(domain) {
- return psl.get(domain);
-}
-
-exports.getPublicSuffix = getPublicSuffix;
diff --git a/node_modules/tough-cookie/lib/store.js b/node_modules/tough-cookie/lib/store.js
deleted file mode 100644
index 859208fc9..000000000
--- a/node_modules/tough-cookie/lib/store.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*!
- * Copyright (c) 2015, Salesforce.com, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-'use strict';
-/*jshint unused:false */
-
-function Store() {
-}
-exports.Store = Store;
-
-// Stores may be synchronous, but are still required to use a
-// Continuation-Passing Style API. The CookieJar itself will expose a "*Sync"
-// API that converts from synchronous-callbacks to imperative style.
-Store.prototype.synchronous = false;
-
-Store.prototype.findCookie = function(domain, path, key, cb) {
- throw new Error('findCookie is not implemented');
-};
-
-Store.prototype.findCookies = function(domain, path, cb) {
- throw new Error('findCookies is not implemented');
-};
-
-Store.prototype.putCookie = function(cookie, cb) {
- throw new Error('putCookie is not implemented');
-};
-
-Store.prototype.updateCookie = function(oldCookie, newCookie, cb) {
- // recommended default implementation:
- // return this.putCookie(newCookie, cb);
- throw new Error('updateCookie is not implemented');
-};
-
-Store.prototype.removeCookie = function(domain, path, key, cb) {
- throw new Error('removeCookie is not implemented');
-};
-
-Store.prototype.removeCookies = function(domain, path, cb) {
- throw new Error('removeCookies is not implemented');
-};
-
-Store.prototype.removeAllCookies = function(cb) {
- throw new Error('removeAllCookies is not implemented');
-}
-
-Store.prototype.getAllCookies = function(cb) {
- throw new Error('getAllCookies is not implemented (therefore jar cannot be serialized)');
-};
diff --git a/node_modules/tough-cookie/lib/version.js b/node_modules/tough-cookie/lib/version.js
deleted file mode 100644
index 4e71108c3..000000000
--- a/node_modules/tough-cookie/lib/version.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// generated by genversion
-module.exports = '3.0.1'
diff --git a/node_modules/tough-cookie/package.json b/node_modules/tough-cookie/package.json
deleted file mode 100644
index dcd328753..000000000
--- a/node_modules/tough-cookie/package.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
- "author": {
- "name": "Jeremy Stashewsky",
- "email": "jstash@gmail.com",
- "website": "https://github.com/stash"
- },
- "contributors": [
- {
- "name": "Alexander Savin",
- "website": "https://github.com/apsavin"
- },
- {
- "name": "Ian Livingstone",
- "website": "https://github.com/ianlivingstone"
- },
- {
- "name": "Ivan Nikulin",
- "website": "https://github.com/inikulin"
- },
- {
- "name": "Lalit Kapoor",
- "website": "https://github.com/lalitkapoor"
- },
- {
- "name": "Sam Thompson",
- "website": "https://github.com/sambthompson"
- },
- {
- "name": "Sebastian Mayr",
- "website": "https://github.com/Sebmaster"
- }
- ],
- "license": "BSD-3-Clause",
- "name": "tough-cookie",
- "description": "RFC6265 Cookies and Cookie Jar for node.js",
- "keywords": [
- "HTTP",
- "cookie",
- "cookies",
- "set-cookie",
- "cookiejar",
- "jar",
- "RFC6265",
- "RFC2965"
- ],
- "version": "3.0.1",
- "homepage": "https://github.com/salesforce/tough-cookie",
- "repository": {
- "type": "git",
- "url": "git://github.com/salesforce/tough-cookie.git"
- },
- "bugs": {
- "url": "https://github.com/salesforce/tough-cookie/issues"
- },
- "main": "./lib/cookie",
- "files": [
- "lib"
- ],
- "scripts": {
- "version": "genversion lib/version.js && git add lib/version.js",
- "test": "vows test/*_test.js",
- "cover": "nyc --reporter=lcov --reporter=html vows test/*_test.js"
- },
- "engines": {
- "node": ">=6"
- },
- "devDependencies": {
- "async": "^1.4.2",
- "genversion": "^2.1.0",
- "nyc": "^11.6.0",
- "string.prototype.repeat": "^0.2.0",
- "vows": "^0.8.2"
- },
- "dependencies": {
- "ip-regex": "^2.1.0",
- "psl": "^1.1.28",
- "punycode": "^2.1.1"
- }
-}