5089 lines
264 KiB
JavaScript
5089 lines
264 KiB
JavaScript
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||
|
if(typeof exports === 'object' && typeof module === 'object')
|
||
|
module.exports = factory();
|
||
|
else if(typeof define === 'function' && define.amd)
|
||
|
define([], factory);
|
||
|
else if(typeof exports === 'object')
|
||
|
exports["ToughCookie"] = factory();
|
||
|
else
|
||
|
root["ToughCookie"] = factory();
|
||
|
})(this, function() {
|
||
|
return /******/ (function(modules) { // webpackBootstrap
|
||
|
/******/ // The module cache
|
||
|
/******/ var installedModules = {};
|
||
|
|
||
|
/******/ // The require function
|
||
|
/******/ function __webpack_require__(moduleId) {
|
||
|
|
||
|
/******/ // Check if module is in cache
|
||
|
/******/ if(installedModules[moduleId])
|
||
|
/******/ return installedModules[moduleId].exports;
|
||
|
|
||
|
/******/ // Create a new module (and put it into the cache)
|
||
|
/******/ var module = installedModules[moduleId] = {
|
||
|
/******/ exports: {},
|
||
|
/******/ id: moduleId,
|
||
|
/******/ loaded: false
|
||
|
/******/ };
|
||
|
|
||
|
/******/ // Execute the module function
|
||
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
|
|
||
|
/******/ // Flag the module as loaded
|
||
|
/******/ module.loaded = true;
|
||
|
|
||
|
/******/ // Return the exports of the module
|
||
|
/******/ return module.exports;
|
||
|
/******/ }
|
||
|
|
||
|
|
||
|
/******/ // expose the modules object (__webpack_modules__)
|
||
|
/******/ __webpack_require__.m = modules;
|
||
|
|
||
|
/******/ // expose the module cache
|
||
|
/******/ __webpack_require__.c = installedModules;
|
||
|
|
||
|
/******/ // __webpack_public_path__
|
||
|
/******/ __webpack_require__.p = "";
|
||
|
|
||
|
/******/ // Load entry module and return exports
|
||
|
/******/ return __webpack_require__(0);
|
||
|
/******/ })
|
||
|
/************************************************************************/
|
||
|
/******/ ([
|
||
|
/* 0 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/*!
|
||
|
* 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 net = __webpack_require__(1);
|
||
|
var urlParse = __webpack_require__(2).parse;
|
||
|
var util = __webpack_require__(9);
|
||
|
var pubsuffix = __webpack_require__(13);
|
||
|
var Store = __webpack_require__(17).Store;
|
||
|
var MemoryCookieStore = __webpack_require__(18).MemoryCookieStore;
|
||
|
var pathMatch = __webpack_require__(20).pathMatch;
|
||
|
var VERSION = __webpack_require__(21).version;
|
||
|
|
||
|
var punycode;
|
||
|
try {
|
||
|
punycode = __webpack_require__(15);
|
||
|
} 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 (net.isIP(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 (!(cookie instanceof Cookie)) {
|
||
|
cookie = Cookie.parse(cookie, { loose: loose });
|
||
|
}
|
||
|
if (!cookie) {
|
||
|
err = new Error("Cookie failed to parse");
|
||
|
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;
|
||
|
|
||
|
CAN_BE_SYNC.push('clone');
|
||
|
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(newStore, serialized, cb);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
// 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.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 = __webpack_require__(19).permuteDomain;
|
||
|
exports.permutePath = permutePath;
|
||
|
exports.canonicalDomain = canonicalDomain;
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 1 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
/*
|
||
|
* Tests if a given ip or host string is a valid IPv4 or IPv6 address.
|
||
|
* Regex found at: https://stackoverflow.com/questions/9208814/validate-ipv4-ipv6-and-hostname
|
||
|
*/
|
||
|
|
||
|
var patternIPv4 = /^\s*((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\s*$/g;
|
||
|
var patternIPv6 = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/g;
|
||
|
|
||
|
function isIPv4(hostOrIp) {
|
||
|
return hostOrIp.match(patternIPv4) ? true : false;
|
||
|
}
|
||
|
|
||
|
function isIPv6(hostOrIp) {
|
||
|
return hostOrIp.match(patternIPv6) ? true : false;
|
||
|
}
|
||
|
|
||
|
function isIP(hostOrIp) {
|
||
|
if (isIPv4(hostOrIp)) {
|
||
|
return 4;
|
||
|
}
|
||
|
|
||
|
if (isIPv6(hostOrIp)) {
|
||
|
return 6;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
isIPv4: isIPv4,
|
||
|
isIPv6: isIPv6,
|
||
|
isIP: isIP
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 2 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||
|
//
|
||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
// copy of this software and associated documentation files (the
|
||
|
// "Software"), to deal in the Software without restriction, including
|
||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||
|
// persons to whom the Software is furnished to do so, subject to the
|
||
|
// following conditions:
|
||
|
//
|
||
|
// The above copyright notice and this permission notice shall be included
|
||
|
// in all copies or substantial portions of the Software.
|
||
|
//
|
||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
var punycode = __webpack_require__(3);
|
||
|
var util = __webpack_require__(5);
|
||
|
|
||
|
exports.parse = urlParse;
|
||
|
exports.resolve = urlResolve;
|
||
|
exports.resolveObject = urlResolveObject;
|
||
|
exports.format = urlFormat;
|
||
|
|
||
|
exports.Url = Url;
|
||
|
|
||
|
function Url() {
|
||
|
this.protocol = null;
|
||
|
this.slashes = null;
|
||
|
this.auth = null;
|
||
|
this.host = null;
|
||
|
this.port = null;
|
||
|
this.hostname = null;
|
||
|
this.hash = null;
|
||
|
this.search = null;
|
||
|
this.query = null;
|
||
|
this.pathname = null;
|
||
|
this.path = null;
|
||
|
this.href = null;
|
||
|
}
|
||
|
|
||
|
// Reference: RFC 3986, RFC 1808, RFC 2396
|
||
|
|
||
|
// define these here so at least they only have to be
|
||
|
// compiled once on the first module load.
|
||
|
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
||
|
portPattern = /:[0-9]*$/,
|
||
|
|
||
|
// Special case for a simple path URL
|
||
|
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
||
|
|
||
|
// RFC 2396: characters reserved for delimiting URLs.
|
||
|
// We actually just auto-escape these.
|
||
|
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
||
|
|
||
|
// RFC 2396: characters not allowed for various reasons.
|
||
|
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
||
|
|
||
|
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
||
|
autoEscape = ['\''].concat(unwise),
|
||
|
// Characters that are never ever allowed in a hostname.
|
||
|
// Note that any invalid chars are also handled, but these
|
||
|
// are the ones that are *expected* to be seen, so we fast-path
|
||
|
// them.
|
||
|
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
||
|
hostEndingChars = ['/', '?', '#'],
|
||
|
hostnameMaxLen = 255,
|
||
|
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
||
|
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
||
|
// protocols that can allow "unsafe" and "unwise" chars.
|
||
|
unsafeProtocol = {
|
||
|
'javascript': true,
|
||
|
'javascript:': true
|
||
|
},
|
||
|
// protocols that never have a hostname.
|
||
|
hostlessProtocol = {
|
||
|
'javascript': true,
|
||
|
'javascript:': true
|
||
|
},
|
||
|
// protocols that always contain a // bit.
|
||
|
slashedProtocol = {
|
||
|
'http': true,
|
||
|
'https': true,
|
||
|
'ftp': true,
|
||
|
'gopher': true,
|
||
|
'file': true,
|
||
|
'http:': true,
|
||
|
'https:': true,
|
||
|
'ftp:': true,
|
||
|
'gopher:': true,
|
||
|
'file:': true
|
||
|
},
|
||
|
querystring = __webpack_require__(6);
|
||
|
|
||
|
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
||
|
if (url && util.isObject(url) && url instanceof Url) return url;
|
||
|
|
||
|
var u = new Url;
|
||
|
u.parse(url, parseQueryString, slashesDenoteHost);
|
||
|
return u;
|
||
|
}
|
||
|
|
||
|
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
||
|
if (!util.isString(url)) {
|
||
|
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
||
|
}
|
||
|
|
||
|
// Copy chrome, IE, opera backslash-handling behavior.
|
||
|
// Back slashes before the query string get converted to forward slashes
|
||
|
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
||
|
var queryIndex = url.indexOf('?'),
|
||
|
splitter =
|
||
|
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
||
|
uSplit = url.split(splitter),
|
||
|
slashRegex = /\\/g;
|
||
|
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
||
|
url = uSplit.join(splitter);
|
||
|
|
||
|
var rest = url;
|
||
|
|
||
|
// trim before proceeding.
|
||
|
// This is to support parse stuff like " http://foo.com \n"
|
||
|
rest = rest.trim();
|
||
|
|
||
|
if (!slashesDenoteHost && url.split('#').length === 1) {
|
||
|
// Try fast path regexp
|
||
|
var simplePath = simplePathPattern.exec(rest);
|
||
|
if (simplePath) {
|
||
|
this.path = rest;
|
||
|
this.href = rest;
|
||
|
this.pathname = simplePath[1];
|
||
|
if (simplePath[2]) {
|
||
|
this.search = simplePath[2];
|
||
|
if (parseQueryString) {
|
||
|
this.query = querystring.parse(this.search.substr(1));
|
||
|
} else {
|
||
|
this.query = this.search.substr(1);
|
||
|
}
|
||
|
} else if (parseQueryString) {
|
||
|
this.search = '';
|
||
|
this.query = {};
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var proto = protocolPattern.exec(rest);
|
||
|
if (proto) {
|
||
|
proto = proto[0];
|
||
|
var lowerProto = proto.toLowerCase();
|
||
|
this.protocol = lowerProto;
|
||
|
rest = rest.substr(proto.length);
|
||
|
}
|
||
|
|
||
|
// figure out if it's got a host
|
||
|
// user@server is *always* interpreted as a hostname, and url
|
||
|
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
||
|
// how the browser resolves relative URLs.
|
||
|
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
||
|
var slashes = rest.substr(0, 2) === '//';
|
||
|
if (slashes && !(proto && hostlessProtocol[proto])) {
|
||
|
rest = rest.substr(2);
|
||
|
this.slashes = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!hostlessProtocol[proto] &&
|
||
|
(slashes || (proto && !slashedProtocol[proto]))) {
|
||
|
|
||
|
// there's a hostname.
|
||
|
// the first instance of /, ?, ;, or # ends the host.
|
||
|
//
|
||
|
// If there is an @ in the hostname, then non-host chars *are* allowed
|
||
|
// to the left of the last @ sign, unless some host-ending character
|
||
|
// comes *before* the @-sign.
|
||
|
// URLs are obnoxious.
|
||
|
//
|
||
|
// ex:
|
||
|
// http://a@b@c/ => user:a@b host:c
|
||
|
// http://a@b?@c => user:a host:c path:/?@c
|
||
|
|
||
|
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
||
|
// Review our test case against browsers more comprehensively.
|
||
|
|
||
|
// find the first instance of any hostEndingChars
|
||
|
var hostEnd = -1;
|
||
|
for (var i = 0; i < hostEndingChars.length; i++) {
|
||
|
var hec = rest.indexOf(hostEndingChars[i]);
|
||
|
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
||
|
hostEnd = hec;
|
||
|
}
|
||
|
|
||
|
// at this point, either we have an explicit point where the
|
||
|
// auth portion cannot go past, or the last @ char is the decider.
|
||
|
var auth, atSign;
|
||
|
if (hostEnd === -1) {
|
||
|
// atSign can be anywhere.
|
||
|
atSign = rest.lastIndexOf('@');
|
||
|
} else {
|
||
|
// atSign must be in auth portion.
|
||
|
// http://a@b/c@d => host:b auth:a path:/c@d
|
||
|
atSign = rest.lastIndexOf('@', hostEnd);
|
||
|
}
|
||
|
|
||
|
// Now we have a portion which is definitely the auth.
|
||
|
// Pull that off.
|
||
|
if (atSign !== -1) {
|
||
|
auth = rest.slice(0, atSign);
|
||
|
rest = rest.slice(atSign + 1);
|
||
|
this.auth = decodeURIComponent(auth);
|
||
|
}
|
||
|
|
||
|
// the host is the remaining to the left of the first non-host char
|
||
|
hostEnd = -1;
|
||
|
for (var i = 0; i < nonHostChars.length; i++) {
|
||
|
var hec = rest.indexOf(nonHostChars[i]);
|
||
|
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
||
|
hostEnd = hec;
|
||
|
}
|
||
|
// if we still have not hit it, then the entire thing is a host.
|
||
|
if (hostEnd === -1)
|
||
|
hostEnd = rest.length;
|
||
|
|
||
|
this.host = rest.slice(0, hostEnd);
|
||
|
rest = rest.slice(hostEnd);
|
||
|
|
||
|
// pull out port.
|
||
|
this.parseHost();
|
||
|
|
||
|
// we've indicated that there is a hostname,
|
||
|
// so even if it's empty, it has to be present.
|
||
|
this.hostname = this.hostname || '';
|
||
|
|
||
|
// if hostname begins with [ and ends with ]
|
||
|
// assume that it's an IPv6 address.
|
||
|
var ipv6Hostname = this.hostname[0] === '[' &&
|
||
|
this.hostname[this.hostname.length - 1] === ']';
|
||
|
|
||
|
// validate a little.
|
||
|
if (!ipv6Hostname) {
|
||
|
var hostparts = this.hostname.split(/\./);
|
||
|
for (var i = 0, l = hostparts.length; i < l; i++) {
|
||
|
var part = hostparts[i];
|
||
|
if (!part) continue;
|
||
|
if (!part.match(hostnamePartPattern)) {
|
||
|
var newpart = '';
|
||
|
for (var j = 0, k = part.length; j < k; j++) {
|
||
|
if (part.charCodeAt(j) > 127) {
|
||
|
// we replace non-ASCII char with a temporary placeholder
|
||
|
// we need this to make sure size of hostname is not
|
||
|
// broken by replacing non-ASCII by nothing
|
||
|
newpart += 'x';
|
||
|
} else {
|
||
|
newpart += part[j];
|
||
|
}
|
||
|
}
|
||
|
// we test again with ASCII char only
|
||
|
if (!newpart.match(hostnamePartPattern)) {
|
||
|
var validParts = hostparts.slice(0, i);
|
||
|
var notHost = hostparts.slice(i + 1);
|
||
|
var bit = part.match(hostnamePartStart);
|
||
|
if (bit) {
|
||
|
validParts.push(bit[1]);
|
||
|
notHost.unshift(bit[2]);
|
||
|
}
|
||
|
if (notHost.length) {
|
||
|
rest = '/' + notHost.join('.') + rest;
|
||
|
}
|
||
|
this.hostname = validParts.join('.');
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (this.hostname.length > hostnameMaxLen) {
|
||
|
this.hostname = '';
|
||
|
} else {
|
||
|
// hostnames are always lower case.
|
||
|
this.hostname = this.hostname.toLowerCase();
|
||
|
}
|
||
|
|
||
|
if (!ipv6Hostname) {
|
||
|
// IDNA Support: Returns a punycoded representation of "domain".
|
||
|
// It only converts parts of the domain name that
|
||
|
// have non-ASCII characters, i.e. it doesn't matter if
|
||
|
// you call it with a domain that already is ASCII-only.
|
||
|
this.hostname = punycode.toASCII(this.hostname);
|
||
|
}
|
||
|
|
||
|
var p = this.port ? ':' + this.port : '';
|
||
|
var h = this.hostname || '';
|
||
|
this.host = h + p;
|
||
|
this.href += this.host;
|
||
|
|
||
|
// strip [ and ] from the hostname
|
||
|
// the host field still retains them, though
|
||
|
if (ipv6Hostname) {
|
||
|
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
||
|
if (rest[0] !== '/') {
|
||
|
rest = '/' + rest;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// now rest is set to the post-host stuff.
|
||
|
// chop off any delim chars.
|
||
|
if (!unsafeProtocol[lowerProto]) {
|
||
|
|
||
|
// First, make 100% sure that any "autoEscape" chars get
|
||
|
// escaped, even if encodeURIComponent doesn't think they
|
||
|
// need to be.
|
||
|
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
||
|
var ae = autoEscape[i];
|
||
|
if (rest.indexOf(ae) === -1)
|
||
|
continue;
|
||
|
var esc = encodeURIComponent(ae);
|
||
|
if (esc === ae) {
|
||
|
esc = escape(ae);
|
||
|
}
|
||
|
rest = rest.split(ae).join(esc);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
// chop off from the tail first.
|
||
|
var hash = rest.indexOf('#');
|
||
|
if (hash !== -1) {
|
||
|
// got a fragment string.
|
||
|
this.hash = rest.substr(hash);
|
||
|
rest = rest.slice(0, hash);
|
||
|
}
|
||
|
var qm = rest.indexOf('?');
|
||
|
if (qm !== -1) {
|
||
|
this.search = rest.substr(qm);
|
||
|
this.query = rest.substr(qm + 1);
|
||
|
if (parseQueryString) {
|
||
|
this.query = querystring.parse(this.query);
|
||
|
}
|
||
|
rest = rest.slice(0, qm);
|
||
|
} else if (parseQueryString) {
|
||
|
// no query string, but parseQueryString still requested
|
||
|
this.search = '';
|
||
|
this.query = {};
|
||
|
}
|
||
|
if (rest) this.pathname = rest;
|
||
|
if (slashedProtocol[lowerProto] &&
|
||
|
this.hostname && !this.pathname) {
|
||
|
this.pathname = '/';
|
||
|
}
|
||
|
|
||
|
//to support http.request
|
||
|
if (this.pathname || this.search) {
|
||
|
var p = this.pathname || '';
|
||
|
var s = this.search || '';
|
||
|
this.path = p + s;
|
||
|
}
|
||
|
|
||
|
// finally, reconstruct the href based on what has been validated.
|
||
|
this.href = this.format();
|
||
|
return this;
|
||
|
};
|
||
|
|
||
|
// format a parsed object into a url string
|
||
|
function urlFormat(obj) {
|
||
|
// ensure it's an object, and not a string url.
|
||
|
// If it's an obj, this is a no-op.
|
||
|
// this way, you can call url_format() on strings
|
||
|
// to clean up potentially wonky urls.
|
||
|
if (util.isString(obj)) obj = urlParse(obj);
|
||
|
if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
||
|
return obj.format();
|
||
|
}
|
||
|
|
||
|
Url.prototype.format = function() {
|
||
|
var auth = this.auth || '';
|
||
|
if (auth) {
|
||
|
auth = encodeURIComponent(auth);
|
||
|
auth = auth.replace(/%3A/i, ':');
|
||
|
auth += '@';
|
||
|
}
|
||
|
|
||
|
var protocol = this.protocol || '',
|
||
|
pathname = this.pathname || '',
|
||
|
hash = this.hash || '',
|
||
|
host = false,
|
||
|
query = '';
|
||
|
|
||
|
if (this.host) {
|
||
|
host = auth + this.host;
|
||
|
} else if (this.hostname) {
|
||
|
host = auth + (this.hostname.indexOf(':') === -1 ?
|
||
|
this.hostname :
|
||
|
'[' + this.hostname + ']');
|
||
|
if (this.port) {
|
||
|
host += ':' + this.port;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (this.query &&
|
||
|
util.isObject(this.query) &&
|
||
|
Object.keys(this.query).length) {
|
||
|
query = querystring.stringify(this.query);
|
||
|
}
|
||
|
|
||
|
var search = this.search || (query && ('?' + query)) || '';
|
||
|
|
||
|
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
||
|
|
||
|
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
||
|
// unless they had them to begin with.
|
||
|
if (this.slashes ||
|
||
|
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
||
|
host = '//' + (host || '');
|
||
|
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
||
|
} else if (!host) {
|
||
|
host = '';
|
||
|
}
|
||
|
|
||
|
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
||
|
if (search && search.charAt(0) !== '?') search = '?' + search;
|
||
|
|
||
|
pathname = pathname.replace(/[?#]/g, function(match) {
|
||
|
return encodeURIComponent(match);
|
||
|
});
|
||
|
search = search.replace('#', '%23');
|
||
|
|
||
|
return protocol + host + pathname + search + hash;
|
||
|
};
|
||
|
|
||
|
function urlResolve(source, relative) {
|
||
|
return urlParse(source, false, true).resolve(relative);
|
||
|
}
|
||
|
|
||
|
Url.prototype.resolve = function(relative) {
|
||
|
return this.resolveObject(urlParse(relative, false, true)).format();
|
||
|
};
|
||
|
|
||
|
function urlResolveObject(source, relative) {
|
||
|
if (!source) return relative;
|
||
|
return urlParse(source, false, true).resolveObject(relative);
|
||
|
}
|
||
|
|
||
|
Url.prototype.resolveObject = function(relative) {
|
||
|
if (util.isString(relative)) {
|
||
|
var rel = new Url();
|
||
|
rel.parse(relative, false, true);
|
||
|
relative = rel;
|
||
|
}
|
||
|
|
||
|
var result = new Url();
|
||
|
var tkeys = Object.keys(this);
|
||
|
for (var tk = 0; tk < tkeys.length; tk++) {
|
||
|
var tkey = tkeys[tk];
|
||
|
result[tkey] = this[tkey];
|
||
|
}
|
||
|
|
||
|
// hash is always overridden, no matter what.
|
||
|
// even href="" will remove it.
|
||
|
result.hash = relative.hash;
|
||
|
|
||
|
// if the relative url is empty, then there's nothing left to do here.
|
||
|
if (relative.href === '') {
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
// hrefs like //foo/bar always cut to the protocol.
|
||
|
if (relative.slashes && !relative.protocol) {
|
||
|
// take everything except the protocol from relative
|
||
|
var rkeys = Object.keys(relative);
|
||
|
for (var rk = 0; rk < rkeys.length; rk++) {
|
||
|
var rkey = rkeys[rk];
|
||
|
if (rkey !== 'protocol')
|
||
|
result[rkey] = relative[rkey];
|
||
|
}
|
||
|
|
||
|
//urlParse appends trailing / to urls like http://www.example.com
|
||
|
if (slashedProtocol[result.protocol] &&
|
||
|
result.hostname && !result.pathname) {
|
||
|
result.path = result.pathname = '/';
|
||
|
}
|
||
|
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
if (relative.protocol && relative.protocol !== result.protocol) {
|
||
|
// if it's a known url protocol, then changing
|
||
|
// the protocol does weird things
|
||
|
// first, if it's not file:, then we MUST have a host,
|
||
|
// and if there was a path
|
||
|
// to begin with, then we MUST have a path.
|
||
|
// if it is file:, then the host is dropped,
|
||
|
// because that's known to be hostless.
|
||
|
// anything else is assumed to be absolute.
|
||
|
if (!slashedProtocol[relative.protocol]) {
|
||
|
var keys = Object.keys(relative);
|
||
|
for (var v = 0; v < keys.length; v++) {
|
||
|
var k = keys[v];
|
||
|
result[k] = relative[k];
|
||
|
}
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
result.protocol = relative.protocol;
|
||
|
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
||
|
var relPath = (relative.pathname || '').split('/');
|
||
|
while (relPath.length && !(relative.host = relPath.shift()));
|
||
|
if (!relative.host) relative.host = '';
|
||
|
if (!relative.hostname) relative.hostname = '';
|
||
|
if (relPath[0] !== '') relPath.unshift('');
|
||
|
if (relPath.length < 2) relPath.unshift('');
|
||
|
result.pathname = relPath.join('/');
|
||
|
} else {
|
||
|
result.pathname = relative.pathname;
|
||
|
}
|
||
|
result.search = relative.search;
|
||
|
result.query = relative.query;
|
||
|
result.host = relative.host || '';
|
||
|
result.auth = relative.auth;
|
||
|
result.hostname = relative.hostname || relative.host;
|
||
|
result.port = relative.port;
|
||
|
// to support http.request
|
||
|
if (result.pathname || result.search) {
|
||
|
var p = result.pathname || '';
|
||
|
var s = result.search || '';
|
||
|
result.path = p + s;
|
||
|
}
|
||
|
result.slashes = result.slashes || relative.slashes;
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
||
|
isRelAbs = (
|
||
|
relative.host ||
|
||
|
relative.pathname && relative.pathname.charAt(0) === '/'
|
||
|
),
|
||
|
mustEndAbs = (isRelAbs || isSourceAbs ||
|
||
|
(result.host && relative.pathname)),
|
||
|
removeAllDots = mustEndAbs,
|
||
|
srcPath = result.pathname && result.pathname.split('/') || [],
|
||
|
relPath = relative.pathname && relative.pathname.split('/') || [],
|
||
|
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
||
|
|
||
|
// if the url is a non-slashed url, then relative
|
||
|
// links like ../.. should be able
|
||
|
// to crawl up to the hostname, as well. This is strange.
|
||
|
// result.protocol has already been set by now.
|
||
|
// Later on, put the first path part into the host field.
|
||
|
if (psychotic) {
|
||
|
result.hostname = '';
|
||
|
result.port = null;
|
||
|
if (result.host) {
|
||
|
if (srcPath[0] === '') srcPath[0] = result.host;
|
||
|
else srcPath.unshift(result.host);
|
||
|
}
|
||
|
result.host = '';
|
||
|
if (relative.protocol) {
|
||
|
relative.hostname = null;
|
||
|
relative.port = null;
|
||
|
if (relative.host) {
|
||
|
if (relPath[0] === '') relPath[0] = relative.host;
|
||
|
else relPath.unshift(relative.host);
|
||
|
}
|
||
|
relative.host = null;
|
||
|
}
|
||
|
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
||
|
}
|
||
|
|
||
|
if (isRelAbs) {
|
||
|
// it's absolute.
|
||
|
result.host = (relative.host || relative.host === '') ?
|
||
|
relative.host : result.host;
|
||
|
result.hostname = (relative.hostname || relative.hostname === '') ?
|
||
|
relative.hostname : result.hostname;
|
||
|
result.search = relative.search;
|
||
|
result.query = relative.query;
|
||
|
srcPath = relPath;
|
||
|
// fall through to the dot-handling below.
|
||
|
} else if (relPath.length) {
|
||
|
// it's relative
|
||
|
// throw away the existing file, and take the new path instead.
|
||
|
if (!srcPath) srcPath = [];
|
||
|
srcPath.pop();
|
||
|
srcPath = srcPath.concat(relPath);
|
||
|
result.search = relative.search;
|
||
|
result.query = relative.query;
|
||
|
} else if (!util.isNullOrUndefined(relative.search)) {
|
||
|
// just pull out the search.
|
||
|
// like href='?foo'.
|
||
|
// Put this after the other two cases because it simplifies the booleans
|
||
|
if (psychotic) {
|
||
|
result.hostname = result.host = srcPath.shift();
|
||
|
//occationaly the auth can get stuck only in host
|
||
|
//this especially happens in cases like
|
||
|
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||
|
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||
|
result.host.split('@') : false;
|
||
|
if (authInHost) {
|
||
|
result.auth = authInHost.shift();
|
||
|
result.host = result.hostname = authInHost.shift();
|
||
|
}
|
||
|
}
|
||
|
result.search = relative.search;
|
||
|
result.query = relative.query;
|
||
|
//to support http.request
|
||
|
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
||
|
result.path = (result.pathname ? result.pathname : '') +
|
||
|
(result.search ? result.search : '');
|
||
|
}
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
if (!srcPath.length) {
|
||
|
// no path at all. easy.
|
||
|
// we've already handled the other stuff above.
|
||
|
result.pathname = null;
|
||
|
//to support http.request
|
||
|
if (result.search) {
|
||
|
result.path = '/' + result.search;
|
||
|
} else {
|
||
|
result.path = null;
|
||
|
}
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
// if a url ENDs in . or .., then it must get a trailing slash.
|
||
|
// however, if it ends in anything else non-slashy,
|
||
|
// then it must NOT get a trailing slash.
|
||
|
var last = srcPath.slice(-1)[0];
|
||
|
var hasTrailingSlash = (
|
||
|
(result.host || relative.host || srcPath.length > 1) &&
|
||
|
(last === '.' || last === '..') || last === '');
|
||
|
|
||
|
// strip single dots, resolve double dots to parent dir
|
||
|
// if the path tries to go above the root, `up` ends up > 0
|
||
|
var up = 0;
|
||
|
for (var i = srcPath.length; i >= 0; i--) {
|
||
|
last = srcPath[i];
|
||
|
if (last === '.') {
|
||
|
srcPath.splice(i, 1);
|
||
|
} else if (last === '..') {
|
||
|
srcPath.splice(i, 1);
|
||
|
up++;
|
||
|
} else if (up) {
|
||
|
srcPath.splice(i, 1);
|
||
|
up--;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// if the path is allowed to go above the root, restore leading ..s
|
||
|
if (!mustEndAbs && !removeAllDots) {
|
||
|
for (; up--; up) {
|
||
|
srcPath.unshift('..');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (mustEndAbs && srcPath[0] !== '' &&
|
||
|
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
||
|
srcPath.unshift('');
|
||
|
}
|
||
|
|
||
|
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
||
|
srcPath.push('');
|
||
|
}
|
||
|
|
||
|
var isAbsolute = srcPath[0] === '' ||
|
||
|
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
||
|
|
||
|
// put the host back
|
||
|
if (psychotic) {
|
||
|
result.hostname = result.host = isAbsolute ? '' :
|
||
|
srcPath.length ? srcPath.shift() : '';
|
||
|
//occationaly the auth can get stuck only in host
|
||
|
//this especially happens in cases like
|
||
|
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||
|
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||
|
result.host.split('@') : false;
|
||
|
if (authInHost) {
|
||
|
result.auth = authInHost.shift();
|
||
|
result.host = result.hostname = authInHost.shift();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
||
|
|
||
|
if (mustEndAbs && !isAbsolute) {
|
||
|
srcPath.unshift('');
|
||
|
}
|
||
|
|
||
|
if (!srcPath.length) {
|
||
|
result.pathname = null;
|
||
|
result.path = null;
|
||
|
} else {
|
||
|
result.pathname = srcPath.join('/');
|
||
|
}
|
||
|
|
||
|
//to support request.http
|
||
|
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
||
|
result.path = (result.pathname ? result.pathname : '') +
|
||
|
(result.search ? result.search : '');
|
||
|
}
|
||
|
result.auth = relative.auth || result.auth;
|
||
|
result.slashes = result.slashes || relative.slashes;
|
||
|
result.href = result.format();
|
||
|
return result;
|
||
|
};
|
||
|
|
||
|
Url.prototype.parseHost = function() {
|
||
|
var host = this.host;
|
||
|
var port = portPattern.exec(host);
|
||
|
if (port) {
|
||
|
port = port[0];
|
||
|
if (port !== ':') {
|
||
|
this.port = port.substr(1);
|
||
|
}
|
||
|
host = host.substr(0, host.length - port.length);
|
||
|
}
|
||
|
if (host) this.hostname = host;
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 3 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */
|
||
|
;(function(root) {
|
||
|
|
||
|
/** Detect free variables */
|
||
|
var freeExports = typeof exports == 'object' && exports &&
|
||
|
!exports.nodeType && exports;
|
||
|
var freeModule = typeof module == 'object' && module &&
|
||
|
!module.nodeType && module;
|
||
|
var freeGlobal = typeof global == 'object' && global;
|
||
|
if (
|
||
|
freeGlobal.global === freeGlobal ||
|
||
|
freeGlobal.window === freeGlobal ||
|
||
|
freeGlobal.self === freeGlobal
|
||
|
) {
|
||
|
root = freeGlobal;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The `punycode` object.
|
||
|
* @name punycode
|
||
|
* @type Object
|
||
|
*/
|
||
|
var punycode,
|
||
|
|
||
|
/** Highest positive signed 32-bit float value */
|
||
|
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
||
|
|
||
|
/** Bootstring parameters */
|
||
|
base = 36,
|
||
|
tMin = 1,
|
||
|
tMax = 26,
|
||
|
skew = 38,
|
||
|
damp = 700,
|
||
|
initialBias = 72,
|
||
|
initialN = 128, // 0x80
|
||
|
delimiter = '-', // '\x2D'
|
||
|
|
||
|
/** Regular expressions */
|
||
|
regexPunycode = /^xn--/,
|
||
|
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
||
|
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
||
|
|
||
|
/** Error messages */
|
||
|
errors = {
|
||
|
'overflow': 'Overflow: input needs wider integers to process',
|
||
|
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||
|
'invalid-input': 'Invalid input'
|
||
|
},
|
||
|
|
||
|
/** Convenience shortcuts */
|
||
|
baseMinusTMin = base - tMin,
|
||
|
floor = Math.floor,
|
||
|
stringFromCharCode = String.fromCharCode,
|
||
|
|
||
|
/** Temporary variable */
|
||
|
key;
|
||
|
|
||
|
/*--------------------------------------------------------------------------*/
|
||
|
|
||
|
/**
|
||
|
* A generic error utility function.
|
||
|
* @private
|
||
|
* @param {String} type The error type.
|
||
|
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||
|
*/
|
||
|
function error(type) {
|
||
|
throw RangeError(errors[type]);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A generic `Array#map` utility function.
|
||
|
* @private
|
||
|
* @param {Array} array The array to iterate over.
|
||
|
* @param {Function} callback The function that gets called for every array
|
||
|
* item.
|
||
|
* @returns {Array} A new array of values returned by the callback function.
|
||
|
*/
|
||
|
function map(array, fn) {
|
||
|
var length = array.length;
|
||
|
var result = [];
|
||
|
while (length--) {
|
||
|
result[length] = fn(array[length]);
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||
|
* addresses.
|
||
|
* @private
|
||
|
* @param {String} domain The domain name or email address.
|
||
|
* @param {Function} callback The function that gets called for every
|
||
|
* character.
|
||
|
* @returns {Array} A new string of characters returned by the callback
|
||
|
* function.
|
||
|
*/
|
||
|
function mapDomain(string, fn) {
|
||
|
var parts = string.split('@');
|
||
|
var result = '';
|
||
|
if (parts.length > 1) {
|
||
|
// In email addresses, only the domain name should be punycoded. Leave
|
||
|
// the local part (i.e. everything up to `@`) intact.
|
||
|
result = parts[0] + '@';
|
||
|
string = parts[1];
|
||
|
}
|
||
|
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||
|
string = string.replace(regexSeparators, '\x2E');
|
||
|
var labels = string.split('.');
|
||
|
var encoded = map(labels, fn).join('.');
|
||
|
return result + encoded;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates an array containing the numeric code points of each Unicode
|
||
|
* character in the string. While JavaScript uses UCS-2 internally,
|
||
|
* this function will convert a pair of surrogate halves (each of which
|
||
|
* UCS-2 exposes as separate characters) into a single code point,
|
||
|
* matching UTF-16.
|
||
|
* @see `punycode.ucs2.encode`
|
||
|
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||
|
* @memberOf punycode.ucs2
|
||
|
* @name decode
|
||
|
* @param {String} string The Unicode input string (UCS-2).
|
||
|
* @returns {Array} The new array of code points.
|
||
|
*/
|
||
|
function ucs2decode(string) {
|
||
|
var output = [],
|
||
|
counter = 0,
|
||
|
length = string.length,
|
||
|
value,
|
||
|
extra;
|
||
|
while (counter < length) {
|
||
|
value = string.charCodeAt(counter++);
|
||
|
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||
|
// high surrogate, and there is a next character
|
||
|
extra = string.charCodeAt(counter++);
|
||
|
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
||
|
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||
|
} else {
|
||
|
// unmatched surrogate; only append this code unit, in case the next
|
||
|
// code unit is the high surrogate of a surrogate pair
|
||
|
output.push(value);
|
||
|
counter--;
|
||
|
}
|
||
|
} else {
|
||
|
output.push(value);
|
||
|
}
|
||
|
}
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates a string based on an array of numeric code points.
|
||
|
* @see `punycode.ucs2.decode`
|
||
|
* @memberOf punycode.ucs2
|
||
|
* @name encode
|
||
|
* @param {Array} codePoints The array of numeric code points.
|
||
|
* @returns {String} The new Unicode string (UCS-2).
|
||
|
*/
|
||
|
function ucs2encode(array) {
|
||
|
return map(array, function(value) {
|
||
|
var output = '';
|
||
|
if (value > 0xFFFF) {
|
||
|
value -= 0x10000;
|
||
|
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
||
|
value = 0xDC00 | value & 0x3FF;
|
||
|
}
|
||
|
output += stringFromCharCode(value);
|
||
|
return output;
|
||
|
}).join('');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a basic code point into a digit/integer.
|
||
|
* @see `digitToBasic()`
|
||
|
* @private
|
||
|
* @param {Number} codePoint The basic numeric code point value.
|
||
|
* @returns {Number} The numeric value of a basic code point (for use in
|
||
|
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||
|
* the code point does not represent a value.
|
||
|
*/
|
||
|
function basicToDigit(codePoint) {
|
||
|
if (codePoint - 48 < 10) {
|
||
|
return codePoint - 22;
|
||
|
}
|
||
|
if (codePoint - 65 < 26) {
|
||
|
return codePoint - 65;
|
||
|
}
|
||
|
if (codePoint - 97 < 26) {
|
||
|
return codePoint - 97;
|
||
|
}
|
||
|
return base;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a digit/integer into a basic code point.
|
||
|
* @see `basicToDigit()`
|
||
|
* @private
|
||
|
* @param {Number} digit The numeric value of a basic code point.
|
||
|
* @returns {Number} The basic code point whose value (when used for
|
||
|
* representing integers) is `digit`, which needs to be in the range
|
||
|
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||
|
* used; else, the lowercase form is used. The behavior is undefined
|
||
|
* if `flag` is non-zero and `digit` has no uppercase form.
|
||
|
*/
|
||
|
function digitToBasic(digit, flag) {
|
||
|
// 0..25 map to ASCII a..z or A..Z
|
||
|
// 26..35 map to ASCII 0..9
|
||
|
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||
|
* http://tools.ietf.org/html/rfc3492#section-3.4
|
||
|
* @private
|
||
|
*/
|
||
|
function adapt(delta, numPoints, firstTime) {
|
||
|
var k = 0;
|
||
|
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||
|
delta += floor(delta / numPoints);
|
||
|
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||
|
delta = floor(delta / baseMinusTMin);
|
||
|
}
|
||
|
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||
|
* symbols.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The Punycode string of ASCII-only symbols.
|
||
|
* @returns {String} The resulting string of Unicode symbols.
|
||
|
*/
|
||
|
function decode(input) {
|
||
|
// Don't use UCS-2
|
||
|
var output = [],
|
||
|
inputLength = input.length,
|
||
|
out,
|
||
|
i = 0,
|
||
|
n = initialN,
|
||
|
bias = initialBias,
|
||
|
basic,
|
||
|
j,
|
||
|
index,
|
||
|
oldi,
|
||
|
w,
|
||
|
k,
|
||
|
digit,
|
||
|
t,
|
||
|
/** Cached calculation results */
|
||
|
baseMinusT;
|
||
|
|
||
|
// Handle the basic code points: let `basic` be the number of input code
|
||
|
// points before the last delimiter, or `0` if there is none, then copy
|
||
|
// the first basic code points to the output.
|
||
|
|
||
|
basic = input.lastIndexOf(delimiter);
|
||
|
if (basic < 0) {
|
||
|
basic = 0;
|
||
|
}
|
||
|
|
||
|
for (j = 0; j < basic; ++j) {
|
||
|
// if it's not a basic code point
|
||
|
if (input.charCodeAt(j) >= 0x80) {
|
||
|
error('not-basic');
|
||
|
}
|
||
|
output.push(input.charCodeAt(j));
|
||
|
}
|
||
|
|
||
|
// Main decoding loop: start just after the last delimiter if any basic code
|
||
|
// points were copied; start at the beginning otherwise.
|
||
|
|
||
|
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||
|
|
||
|
// `index` is the index of the next character to be consumed.
|
||
|
// Decode a generalized variable-length integer into `delta`,
|
||
|
// which gets added to `i`. The overflow checking is easier
|
||
|
// if we increase `i` as we go, then subtract off its starting
|
||
|
// value at the end to obtain `delta`.
|
||
|
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
||
|
|
||
|
if (index >= inputLength) {
|
||
|
error('invalid-input');
|
||
|
}
|
||
|
|
||
|
digit = basicToDigit(input.charCodeAt(index++));
|
||
|
|
||
|
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
i += digit * w;
|
||
|
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||
|
|
||
|
if (digit < t) {
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
baseMinusT = base - t;
|
||
|
if (w > floor(maxInt / baseMinusT)) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
w *= baseMinusT;
|
||
|
|
||
|
}
|
||
|
|
||
|
out = output.length + 1;
|
||
|
bias = adapt(i - oldi, out, oldi == 0);
|
||
|
|
||
|
// `i` was supposed to wrap around from `out` to `0`,
|
||
|
// incrementing `n` each time, so we'll fix that now:
|
||
|
if (floor(i / out) > maxInt - n) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
n += floor(i / out);
|
||
|
i %= out;
|
||
|
|
||
|
// Insert `n` at position `i` of the output
|
||
|
output.splice(i++, 0, n);
|
||
|
|
||
|
}
|
||
|
|
||
|
return ucs2encode(output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||
|
* Punycode string of ASCII-only symbols.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The string of Unicode symbols.
|
||
|
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||
|
*/
|
||
|
function encode(input) {
|
||
|
var n,
|
||
|
delta,
|
||
|
handledCPCount,
|
||
|
basicLength,
|
||
|
bias,
|
||
|
j,
|
||
|
m,
|
||
|
q,
|
||
|
k,
|
||
|
t,
|
||
|
currentValue,
|
||
|
output = [],
|
||
|
/** `inputLength` will hold the number of code points in `input`. */
|
||
|
inputLength,
|
||
|
/** Cached calculation results */
|
||
|
handledCPCountPlusOne,
|
||
|
baseMinusT,
|
||
|
qMinusT;
|
||
|
|
||
|
// Convert the input in UCS-2 to Unicode
|
||
|
input = ucs2decode(input);
|
||
|
|
||
|
// Cache the length
|
||
|
inputLength = input.length;
|
||
|
|
||
|
// Initialize the state
|
||
|
n = initialN;
|
||
|
delta = 0;
|
||
|
bias = initialBias;
|
||
|
|
||
|
// Handle the basic code points
|
||
|
for (j = 0; j < inputLength; ++j) {
|
||
|
currentValue = input[j];
|
||
|
if (currentValue < 0x80) {
|
||
|
output.push(stringFromCharCode(currentValue));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
handledCPCount = basicLength = output.length;
|
||
|
|
||
|
// `handledCPCount` is the number of code points that have been handled;
|
||
|
// `basicLength` is the number of basic code points.
|
||
|
|
||
|
// Finish the basic string - if it is not empty - with a delimiter
|
||
|
if (basicLength) {
|
||
|
output.push(delimiter);
|
||
|
}
|
||
|
|
||
|
// Main encoding loop:
|
||
|
while (handledCPCount < inputLength) {
|
||
|
|
||
|
// All non-basic code points < n have been handled already. Find the next
|
||
|
// larger one:
|
||
|
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
||
|
currentValue = input[j];
|
||
|
if (currentValue >= n && currentValue < m) {
|
||
|
m = currentValue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||
|
// but guard against overflow
|
||
|
handledCPCountPlusOne = handledCPCount + 1;
|
||
|
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
delta += (m - n) * handledCPCountPlusOne;
|
||
|
n = m;
|
||
|
|
||
|
for (j = 0; j < inputLength; ++j) {
|
||
|
currentValue = input[j];
|
||
|
|
||
|
if (currentValue < n && ++delta > maxInt) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
if (currentValue == n) {
|
||
|
// Represent delta as a generalized variable-length integer
|
||
|
for (q = delta, k = base; /* no condition */; k += base) {
|
||
|
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||
|
if (q < t) {
|
||
|
break;
|
||
|
}
|
||
|
qMinusT = q - t;
|
||
|
baseMinusT = base - t;
|
||
|
output.push(
|
||
|
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||
|
);
|
||
|
q = floor(qMinusT / baseMinusT);
|
||
|
}
|
||
|
|
||
|
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||
|
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
||
|
delta = 0;
|
||
|
++handledCPCount;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
++delta;
|
||
|
++n;
|
||
|
|
||
|
}
|
||
|
return output.join('');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a Punycode string representing a domain name or an email address
|
||
|
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||
|
* it doesn't matter if you call it on a string that has already been
|
||
|
* converted to Unicode.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The Punycoded domain name or email address to
|
||
|
* convert to Unicode.
|
||
|
* @returns {String} The Unicode representation of the given Punycode
|
||
|
* string.
|
||
|
*/
|
||
|
function toUnicode(input) {
|
||
|
return mapDomain(input, function(string) {
|
||
|
return regexPunycode.test(string)
|
||
|
? decode(string.slice(4).toLowerCase())
|
||
|
: string;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a Unicode string representing a domain name or an email address to
|
||
|
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||
|
* i.e. it doesn't matter if you call it with a domain that's already in
|
||
|
* ASCII.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The domain name or email address to convert, as a
|
||
|
* Unicode string.
|
||
|
* @returns {String} The Punycode representation of the given domain name or
|
||
|
* email address.
|
||
|
*/
|
||
|
function toASCII(input) {
|
||
|
return mapDomain(input, function(string) {
|
||
|
return regexNonASCII.test(string)
|
||
|
? 'xn--' + encode(string)
|
||
|
: string;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/*--------------------------------------------------------------------------*/
|
||
|
|
||
|
/** Define the public API */
|
||
|
punycode = {
|
||
|
/**
|
||
|
* A string representing the current Punycode.js version number.
|
||
|
* @memberOf punycode
|
||
|
* @type String
|
||
|
*/
|
||
|
'version': '1.3.2',
|
||
|
/**
|
||
|
* An object of methods to convert from JavaScript's internal character
|
||
|
* representation (UCS-2) to Unicode code points, and back.
|
||
|
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||
|
* @memberOf punycode
|
||
|
* @type Object
|
||
|
*/
|
||
|
'ucs2': {
|
||
|
'decode': ucs2decode,
|
||
|
'encode': ucs2encode
|
||
|
},
|
||
|
'decode': decode,
|
||
|
'encode': encode,
|
||
|
'toASCII': toASCII,
|
||
|
'toUnicode': toUnicode
|
||
|
};
|
||
|
|
||
|
/** Expose `punycode` */
|
||
|
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
||
|
// like the following:
|
||
|
if (
|
||
|
true
|
||
|
) {
|
||
|
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
||
|
return punycode;
|
||
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
|
} else if (freeExports && freeModule) {
|
||
|
if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
|
||
|
freeModule.exports = punycode;
|
||
|
} else { // in Narwhal or RingoJS v0.7.0-
|
||
|
for (key in punycode) {
|
||
|
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
||
|
}
|
||
|
}
|
||
|
} else { // in Rhino or a web browser
|
||
|
root.punycode = punycode;
|
||
|
}
|
||
|
|
||
|
}(this));
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)(module), (function() { return this; }())))
|
||
|
|
||
|
/***/ }),
|
||
|
/* 4 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
module.exports = function(module) {
|
||
|
if(!module.webpackPolyfill) {
|
||
|
module.deprecate = function() {};
|
||
|
module.paths = [];
|
||
|
// module.parent = undefined by default
|
||
|
module.children = [];
|
||
|
module.webpackPolyfill = 1;
|
||
|
}
|
||
|
return module;
|
||
|
}
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 5 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
module.exports = {
|
||
|
isString: function(arg) {
|
||
|
return typeof(arg) === 'string';
|
||
|
},
|
||
|
isObject: function(arg) {
|
||
|
return typeof(arg) === 'object' && arg !== null;
|
||
|
},
|
||
|
isNull: function(arg) {
|
||
|
return arg === null;
|
||
|
},
|
||
|
isNullOrUndefined: function(arg) {
|
||
|
return arg == null;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 6 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
exports.decode = exports.parse = __webpack_require__(7);
|
||
|
exports.encode = exports.stringify = __webpack_require__(8);
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 7 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||
|
//
|
||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
// copy of this software and associated documentation files (the
|
||
|
// "Software"), to deal in the Software without restriction, including
|
||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||
|
// persons to whom the Software is furnished to do so, subject to the
|
||
|
// following conditions:
|
||
|
//
|
||
|
// The above copyright notice and this permission notice shall be included
|
||
|
// in all copies or substantial portions of the Software.
|
||
|
//
|
||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
// If obj.hasOwnProperty has been overridden, then calling
|
||
|
// obj.hasOwnProperty(prop) will break.
|
||
|
// See: https://github.com/joyent/node/issues/1707
|
||
|
function hasOwnProperty(obj, prop) {
|
||
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||
|
}
|
||
|
|
||
|
module.exports = function(qs, sep, eq, options) {
|
||
|
sep = sep || '&';
|
||
|
eq = eq || '=';
|
||
|
var obj = {};
|
||
|
|
||
|
if (typeof qs !== 'string' || qs.length === 0) {
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
var regexp = /\+/g;
|
||
|
qs = qs.split(sep);
|
||
|
|
||
|
var maxKeys = 1000;
|
||
|
if (options && typeof options.maxKeys === 'number') {
|
||
|
maxKeys = options.maxKeys;
|
||
|
}
|
||
|
|
||
|
var len = qs.length;
|
||
|
// maxKeys <= 0 means that we should not limit keys count
|
||
|
if (maxKeys > 0 && len > maxKeys) {
|
||
|
len = maxKeys;
|
||
|
}
|
||
|
|
||
|
for (var i = 0; i < len; ++i) {
|
||
|
var x = qs[i].replace(regexp, '%20'),
|
||
|
idx = x.indexOf(eq),
|
||
|
kstr, vstr, k, v;
|
||
|
|
||
|
if (idx >= 0) {
|
||
|
kstr = x.substr(0, idx);
|
||
|
vstr = x.substr(idx + 1);
|
||
|
} else {
|
||
|
kstr = x;
|
||
|
vstr = '';
|
||
|
}
|
||
|
|
||
|
k = decodeURIComponent(kstr);
|
||
|
v = decodeURIComponent(vstr);
|
||
|
|
||
|
if (!hasOwnProperty(obj, k)) {
|
||
|
obj[k] = v;
|
||
|
} else if (Array.isArray(obj[k])) {
|
||
|
obj[k].push(v);
|
||
|
} else {
|
||
|
obj[k] = [obj[k], v];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return obj;
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 8 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||
|
//
|
||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
// copy of this software and associated documentation files (the
|
||
|
// "Software"), to deal in the Software without restriction, including
|
||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||
|
// persons to whom the Software is furnished to do so, subject to the
|
||
|
// following conditions:
|
||
|
//
|
||
|
// The above copyright notice and this permission notice shall be included
|
||
|
// in all copies or substantial portions of the Software.
|
||
|
//
|
||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
var stringifyPrimitive = function(v) {
|
||
|
switch (typeof v) {
|
||
|
case 'string':
|
||
|
return v;
|
||
|
|
||
|
case 'boolean':
|
||
|
return v ? 'true' : 'false';
|
||
|
|
||
|
case 'number':
|
||
|
return isFinite(v) ? v : '';
|
||
|
|
||
|
default:
|
||
|
return '';
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = function(obj, sep, eq, name) {
|
||
|
sep = sep || '&';
|
||
|
eq = eq || '=';
|
||
|
if (obj === null) {
|
||
|
obj = undefined;
|
||
|
}
|
||
|
|
||
|
if (typeof obj === 'object') {
|
||
|
return Object.keys(obj).map(function(k) {
|
||
|
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
||
|
if (Array.isArray(obj[k])) {
|
||
|
return obj[k].map(function(v) {
|
||
|
return ks + encodeURIComponent(stringifyPrimitive(v));
|
||
|
}).join(sep);
|
||
|
} else {
|
||
|
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
||
|
}
|
||
|
}).join(sep);
|
||
|
|
||
|
}
|
||
|
|
||
|
if (!name) return '';
|
||
|
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
||
|
encodeURIComponent(stringifyPrimitive(obj));
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 9 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
|
||
|
//
|
||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
// copy of this software and associated documentation files (the
|
||
|
// "Software"), to deal in the Software without restriction, including
|
||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||
|
// persons to whom the Software is furnished to do so, subject to the
|
||
|
// following conditions:
|
||
|
//
|
||
|
// The above copyright notice and this permission notice shall be included
|
||
|
// in all copies or substantial portions of the Software.
|
||
|
//
|
||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
|
||
|
var formatRegExp = /%[sdj%]/g;
|
||
|
exports.format = function(f) {
|
||
|
if (!isString(f)) {
|
||
|
var objects = [];
|
||
|
for (var i = 0; i < arguments.length; i++) {
|
||
|
objects.push(inspect(arguments[i]));
|
||
|
}
|
||
|
return objects.join(' ');
|
||
|
}
|
||
|
|
||
|
var i = 1;
|
||
|
var args = arguments;
|
||
|
var len = args.length;
|
||
|
var str = String(f).replace(formatRegExp, function(x) {
|
||
|
if (x === '%%') return '%';
|
||
|
if (i >= len) return x;
|
||
|
switch (x) {
|
||
|
case '%s': return String(args[i++]);
|
||
|
case '%d': return Number(args[i++]);
|
||
|
case '%j':
|
||
|
try {
|
||
|
return JSON.stringify(args[i++]);
|
||
|
} catch (_) {
|
||
|
return '[Circular]';
|
||
|
}
|
||
|
default:
|
||
|
return x;
|
||
|
}
|
||
|
});
|
||
|
for (var x = args[i]; i < len; x = args[++i]) {
|
||
|
if (isNull(x) || !isObject(x)) {
|
||
|
str += ' ' + x;
|
||
|
} else {
|
||
|
str += ' ' + inspect(x);
|
||
|
}
|
||
|
}
|
||
|
return str;
|
||
|
};
|
||
|
|
||
|
|
||
|
// Mark that a method should not be used.
|
||
|
// Returns a modified function which warns once by default.
|
||
|
// If --no-deprecation is set, then it is a no-op.
|
||
|
exports.deprecate = function(fn, msg) {
|
||
|
// Allow for deprecating things in the process of starting up.
|
||
|
if (isUndefined(global.process)) {
|
||
|
return function() {
|
||
|
return exports.deprecate(fn, msg).apply(this, arguments);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (process.noDeprecation === true) {
|
||
|
return fn;
|
||
|
}
|
||
|
|
||
|
var warned = false;
|
||
|
function deprecated() {
|
||
|
if (!warned) {
|
||
|
if (process.throwDeprecation) {
|
||
|
throw new Error(msg);
|
||
|
} else if (process.traceDeprecation) {
|
||
|
console.trace(msg);
|
||
|
} else {
|
||
|
console.error(msg);
|
||
|
}
|
||
|
warned = true;
|
||
|
}
|
||
|
return fn.apply(this, arguments);
|
||
|
}
|
||
|
|
||
|
return deprecated;
|
||
|
};
|
||
|
|
||
|
|
||
|
var debugs = {};
|
||
|
var debugEnviron;
|
||
|
exports.debuglog = function(set) {
|
||
|
if (isUndefined(debugEnviron))
|
||
|
debugEnviron = process.env.NODE_DEBUG || '';
|
||
|
set = set.toUpperCase();
|
||
|
if (!debugs[set]) {
|
||
|
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||
|
var pid = process.pid;
|
||
|
debugs[set] = function() {
|
||
|
var msg = exports.format.apply(exports, arguments);
|
||
|
console.error('%s %d: %s', set, pid, msg);
|
||
|
};
|
||
|
} else {
|
||
|
debugs[set] = function() {};
|
||
|
}
|
||
|
}
|
||
|
return debugs[set];
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Echos the value of a value. Trys to print the value out
|
||
|
* in the best way possible given the different types.
|
||
|
*
|
||
|
* @param {Object} obj The object to print out.
|
||
|
* @param {Object} opts Optional options object that alters the output.
|
||
|
*/
|
||
|
/* legacy: obj, showHidden, depth, colors*/
|
||
|
function inspect(obj, opts) {
|
||
|
// default options
|
||
|
var ctx = {
|
||
|
seen: [],
|
||
|
stylize: stylizeNoColor
|
||
|
};
|
||
|
// legacy...
|
||
|
if (arguments.length >= 3) ctx.depth = arguments[2];
|
||
|
if (arguments.length >= 4) ctx.colors = arguments[3];
|
||
|
if (isBoolean(opts)) {
|
||
|
// legacy...
|
||
|
ctx.showHidden = opts;
|
||
|
} else if (opts) {
|
||
|
// got an "options" object
|
||
|
exports._extend(ctx, opts);
|
||
|
}
|
||
|
// set default options
|
||
|
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||
|
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||
|
if (isUndefined(ctx.colors)) ctx.colors = false;
|
||
|
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||
|
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||
|
return formatValue(ctx, obj, ctx.depth);
|
||
|
}
|
||
|
exports.inspect = inspect;
|
||
|
|
||
|
|
||
|
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||
|
inspect.colors = {
|
||
|
'bold' : [1, 22],
|
||
|
'italic' : [3, 23],
|
||
|
'underline' : [4, 24],
|
||
|
'inverse' : [7, 27],
|
||
|
'white' : [37, 39],
|
||
|
'grey' : [90, 39],
|
||
|
'black' : [30, 39],
|
||
|
'blue' : [34, 39],
|
||
|
'cyan' : [36, 39],
|
||
|
'green' : [32, 39],
|
||
|
'magenta' : [35, 39],
|
||
|
'red' : [31, 39],
|
||
|
'yellow' : [33, 39]
|
||
|
};
|
||
|
|
||
|
// Don't use 'blue' not visible on cmd.exe
|
||
|
inspect.styles = {
|
||
|
'special': 'cyan',
|
||
|
'number': 'yellow',
|
||
|
'boolean': 'yellow',
|
||
|
'undefined': 'grey',
|
||
|
'null': 'bold',
|
||
|
'string': 'green',
|
||
|
'date': 'magenta',
|
||
|
// "name": intentionally not styling
|
||
|
'regexp': 'red'
|
||
|
};
|
||
|
|
||
|
|
||
|
function stylizeWithColor(str, styleType) {
|
||
|
var style = inspect.styles[styleType];
|
||
|
|
||
|
if (style) {
|
||
|
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||
|
'\u001b[' + inspect.colors[style][1] + 'm';
|
||
|
} else {
|
||
|
return str;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
function stylizeNoColor(str, styleType) {
|
||
|
return str;
|
||
|
}
|
||
|
|
||
|
|
||
|
function arrayToHash(array) {
|
||
|
var hash = {};
|
||
|
|
||
|
array.forEach(function(val, idx) {
|
||
|
hash[val] = true;
|
||
|
});
|
||
|
|
||
|
return hash;
|
||
|
}
|
||
|
|
||
|
|
||
|
function formatValue(ctx, value, recurseTimes) {
|
||
|
// Provide a hook for user-specified inspect functions.
|
||
|
// Check that value is an object with an inspect function on it
|
||
|
if (ctx.customInspect &&
|
||
|
value &&
|
||
|
isFunction(value.inspect) &&
|
||
|
// Filter out the util module, it's inspect function is special
|
||
|
value.inspect !== exports.inspect &&
|
||
|
// Also filter out any prototype objects using the circular check.
|
||
|
!(value.constructor && value.constructor.prototype === value)) {
|
||
|
var ret = value.inspect(recurseTimes, ctx);
|
||
|
if (!isString(ret)) {
|
||
|
ret = formatValue(ctx, ret, recurseTimes);
|
||
|
}
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
// Primitive types cannot have properties
|
||
|
var primitive = formatPrimitive(ctx, value);
|
||
|
if (primitive) {
|
||
|
return primitive;
|
||
|
}
|
||
|
|
||
|
// Look up the keys of the object.
|
||
|
var keys = Object.keys(value);
|
||
|
var visibleKeys = arrayToHash(keys);
|
||
|
|
||
|
if (ctx.showHidden) {
|
||
|
keys = Object.getOwnPropertyNames(value);
|
||
|
}
|
||
|
|
||
|
// IE doesn't make error fields non-enumerable
|
||
|
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
||
|
if (isError(value)
|
||
|
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
||
|
return formatError(value);
|
||
|
}
|
||
|
|
||
|
// Some type of object without properties can be shortcutted.
|
||
|
if (keys.length === 0) {
|
||
|
if (isFunction(value)) {
|
||
|
var name = value.name ? ': ' + value.name : '';
|
||
|
return ctx.stylize('[Function' + name + ']', 'special');
|
||
|
}
|
||
|
if (isRegExp(value)) {
|
||
|
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||
|
}
|
||
|
if (isDate(value)) {
|
||
|
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||
|
}
|
||
|
if (isError(value)) {
|
||
|
return formatError(value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var base = '', array = false, braces = ['{', '}'];
|
||
|
|
||
|
// Make Array say that they are Array
|
||
|
if (isArray(value)) {
|
||
|
array = true;
|
||
|
braces = ['[', ']'];
|
||
|
}
|
||
|
|
||
|
// Make functions say that they are functions
|
||
|
if (isFunction(value)) {
|
||
|
var n = value.name ? ': ' + value.name : '';
|
||
|
base = ' [Function' + n + ']';
|
||
|
}
|
||
|
|
||
|
// Make RegExps say that they are RegExps
|
||
|
if (isRegExp(value)) {
|
||
|
base = ' ' + RegExp.prototype.toString.call(value);
|
||
|
}
|
||
|
|
||
|
// Make dates with properties first say the date
|
||
|
if (isDate(value)) {
|
||
|
base = ' ' + Date.prototype.toUTCString.call(value);
|
||
|
}
|
||
|
|
||
|
// Make error with message first say the error
|
||
|
if (isError(value)) {
|
||
|
base = ' ' + formatError(value);
|
||
|
}
|
||
|
|
||
|
if (keys.length === 0 && (!array || value.length == 0)) {
|
||
|
return braces[0] + base + braces[1];
|
||
|
}
|
||
|
|
||
|
if (recurseTimes < 0) {
|
||
|
if (isRegExp(value)) {
|
||
|
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||
|
} else {
|
||
|
return ctx.stylize('[Object]', 'special');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ctx.seen.push(value);
|
||
|
|
||
|
var output;
|
||
|
if (array) {
|
||
|
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||
|
} else {
|
||
|
output = keys.map(function(key) {
|
||
|
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
ctx.seen.pop();
|
||
|
|
||
|
return reduceToSingleString(output, base, braces);
|
||
|
}
|
||
|
|
||
|
|
||
|
function formatPrimitive(ctx, value) {
|
||
|
if (isUndefined(value))
|
||
|
return ctx.stylize('undefined', 'undefined');
|
||
|
if (isString(value)) {
|
||
|
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||
|
.replace(/'/g, "\\'")
|
||
|
.replace(/\\"/g, '"') + '\'';
|
||
|
return ctx.stylize(simple, 'string');
|
||
|
}
|
||
|
if (isNumber(value))
|
||
|
return ctx.stylize('' + value, 'number');
|
||
|
if (isBoolean(value))
|
||
|
return ctx.stylize('' + value, 'boolean');
|
||
|
// For some reason typeof null is "object", so special case here.
|
||
|
if (isNull(value))
|
||
|
return ctx.stylize('null', 'null');
|
||
|
}
|
||
|
|
||
|
|
||
|
function formatError(value) {
|
||
|
return '[' + Error.prototype.toString.call(value) + ']';
|
||
|
}
|
||
|
|
||
|
|
||
|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||
|
var output = [];
|
||
|
for (var i = 0, l = value.length; i < l; ++i) {
|
||
|
if (hasOwnProperty(value, String(i))) {
|
||
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||
|
String(i), true));
|
||
|
} else {
|
||
|
output.push('');
|
||
|
}
|
||
|
}
|
||
|
keys.forEach(function(key) {
|
||
|
if (!key.match(/^\d+$/)) {
|
||
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||
|
key, true));
|
||
|
}
|
||
|
});
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
|
||
|
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||
|
var name, str, desc;
|
||
|
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||
|
if (desc.get) {
|
||
|
if (desc.set) {
|
||
|
str = ctx.stylize('[Getter/Setter]', 'special');
|
||
|
} else {
|
||
|
str = ctx.stylize('[Getter]', 'special');
|
||
|
}
|
||
|
} else {
|
||
|
if (desc.set) {
|
||
|
str = ctx.stylize('[Setter]', 'special');
|
||
|
}
|
||
|
}
|
||
|
if (!hasOwnProperty(visibleKeys, key)) {
|
||
|
name = '[' + key + ']';
|
||
|
}
|
||
|
if (!str) {
|
||
|
if (ctx.seen.indexOf(desc.value) < 0) {
|
||
|
if (isNull(recurseTimes)) {
|
||
|
str = formatValue(ctx, desc.value, null);
|
||
|
} else {
|
||
|
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||
|
}
|
||
|
if (str.indexOf('\n') > -1) {
|
||
|
if (array) {
|
||
|
str = str.split('\n').map(function(line) {
|
||
|
return ' ' + line;
|
||
|
}).join('\n').substr(2);
|
||
|
} else {
|
||
|
str = '\n' + str.split('\n').map(function(line) {
|
||
|
return ' ' + line;
|
||
|
}).join('\n');
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
str = ctx.stylize('[Circular]', 'special');
|
||
|
}
|
||
|
}
|
||
|
if (isUndefined(name)) {
|
||
|
if (array && key.match(/^\d+$/)) {
|
||
|
return str;
|
||
|
}
|
||
|
name = JSON.stringify('' + key);
|
||
|
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||
|
name = name.substr(1, name.length - 2);
|
||
|
name = ctx.stylize(name, 'name');
|
||
|
} else {
|
||
|
name = name.replace(/'/g, "\\'")
|
||
|
.replace(/\\"/g, '"')
|
||
|
.replace(/(^"|"$)/g, "'");
|
||
|
name = ctx.stylize(name, 'string');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return name + ': ' + str;
|
||
|
}
|
||
|
|
||
|
|
||
|
function reduceToSingleString(output, base, braces) {
|
||
|
var numLinesEst = 0;
|
||
|
var length = output.reduce(function(prev, cur) {
|
||
|
numLinesEst++;
|
||
|
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||
|
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||
|
}, 0);
|
||
|
|
||
|
if (length > 60) {
|
||
|
return braces[0] +
|
||
|
(base === '' ? '' : base + '\n ') +
|
||
|
' ' +
|
||
|
output.join(',\n ') +
|
||
|
' ' +
|
||
|
braces[1];
|
||
|
}
|
||
|
|
||
|
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||
|
}
|
||
|
|
||
|
|
||
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||
|
// because it is fragile and can be easily faked with `Object.create()`.
|
||
|
function isArray(ar) {
|
||
|
return Array.isArray(ar);
|
||
|
}
|
||
|
exports.isArray = isArray;
|
||
|
|
||
|
function isBoolean(arg) {
|
||
|
return typeof arg === 'boolean';
|
||
|
}
|
||
|
exports.isBoolean = isBoolean;
|
||
|
|
||
|
function isNull(arg) {
|
||
|
return arg === null;
|
||
|
}
|
||
|
exports.isNull = isNull;
|
||
|
|
||
|
function isNullOrUndefined(arg) {
|
||
|
return arg == null;
|
||
|
}
|
||
|
exports.isNullOrUndefined = isNullOrUndefined;
|
||
|
|
||
|
function isNumber(arg) {
|
||
|
return typeof arg === 'number';
|
||
|
}
|
||
|
exports.isNumber = isNumber;
|
||
|
|
||
|
function isString(arg) {
|
||
|
return typeof arg === 'string';
|
||
|
}
|
||
|
exports.isString = isString;
|
||
|
|
||
|
function isSymbol(arg) {
|
||
|
return typeof arg === 'symbol';
|
||
|
}
|
||
|
exports.isSymbol = isSymbol;
|
||
|
|
||
|
function isUndefined(arg) {
|
||
|
return arg === void 0;
|
||
|
}
|
||
|
exports.isUndefined = isUndefined;
|
||
|
|
||
|
function isRegExp(re) {
|
||
|
return isObject(re) && objectToString(re) === '[object RegExp]';
|
||
|
}
|
||
|
exports.isRegExp = isRegExp;
|
||
|
|
||
|
function isObject(arg) {
|
||
|
return typeof arg === 'object' && arg !== null;
|
||
|
}
|
||
|
exports.isObject = isObject;
|
||
|
|
||
|
function isDate(d) {
|
||
|
return isObject(d) && objectToString(d) === '[object Date]';
|
||
|
}
|
||
|
exports.isDate = isDate;
|
||
|
|
||
|
function isError(e) {
|
||
|
return isObject(e) &&
|
||
|
(objectToString(e) === '[object Error]' || e instanceof Error);
|
||
|
}
|
||
|
exports.isError = isError;
|
||
|
|
||
|
function isFunction(arg) {
|
||
|
return typeof arg === 'function';
|
||
|
}
|
||
|
exports.isFunction = isFunction;
|
||
|
|
||
|
function isPrimitive(arg) {
|
||
|
return arg === null ||
|
||
|
typeof arg === 'boolean' ||
|
||
|
typeof arg === 'number' ||
|
||
|
typeof arg === 'string' ||
|
||
|
typeof arg === 'symbol' || // ES6 symbol
|
||
|
typeof arg === 'undefined';
|
||
|
}
|
||
|
exports.isPrimitive = isPrimitive;
|
||
|
|
||
|
exports.isBuffer = __webpack_require__(11);
|
||
|
|
||
|
function objectToString(o) {
|
||
|
return Object.prototype.toString.call(o);
|
||
|
}
|
||
|
|
||
|
|
||
|
function pad(n) {
|
||
|
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||
|
}
|
||
|
|
||
|
|
||
|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||
|
'Oct', 'Nov', 'Dec'];
|
||
|
|
||
|
// 26 Feb 16:19:34
|
||
|
function timestamp() {
|
||
|
var d = new Date();
|
||
|
var time = [pad(d.getHours()),
|
||
|
pad(d.getMinutes()),
|
||
|
pad(d.getSeconds())].join(':');
|
||
|
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||
|
}
|
||
|
|
||
|
|
||
|
// log is just a thin wrapper to console.log that prepends a timestamp
|
||
|
exports.log = function() {
|
||
|
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Inherit the prototype methods from one constructor into another.
|
||
|
*
|
||
|
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
||
|
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
||
|
* during bootstrapping this function needs to be rewritten using some native
|
||
|
* functions as prototype setup using normal JavaScript does not work as
|
||
|
* expected during bootstrapping (see mirror.js in r114903).
|
||
|
*
|
||
|
* @param {function} ctor Constructor function which needs to inherit the
|
||
|
* prototype.
|
||
|
* @param {function} superCtor Constructor function to inherit prototype from.
|
||
|
*/
|
||
|
exports.inherits = __webpack_require__(12);
|
||
|
|
||
|
exports._extend = function(origin, add) {
|
||
|
// Don't do anything if add isn't an object
|
||
|
if (!add || !isObject(add)) return origin;
|
||
|
|
||
|
var keys = Object.keys(add);
|
||
|
var i = keys.length;
|
||
|
while (i--) {
|
||
|
origin[keys[i]] = add[keys[i]];
|
||
|
}
|
||
|
return origin;
|
||
|
};
|
||
|
|
||
|
function hasOwnProperty(obj, prop) {
|
||
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||
|
}
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(10)))
|
||
|
|
||
|
/***/ }),
|
||
|
/* 10 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
// shim for using process in browser
|
||
|
var process = module.exports = {};
|
||
|
|
||
|
// cached from whatever global is present so that test runners that stub it
|
||
|
// don't break things. But we need to wrap it in a try catch in case it is
|
||
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
||
|
// function because try/catches deoptimize in certain engines.
|
||
|
|
||
|
var cachedSetTimeout;
|
||
|
var cachedClearTimeout;
|
||
|
|
||
|
function defaultSetTimout() {
|
||
|
throw new Error('setTimeout has not been defined');
|
||
|
}
|
||
|
function defaultClearTimeout () {
|
||
|
throw new Error('clearTimeout has not been defined');
|
||
|
}
|
||
|
(function () {
|
||
|
try {
|
||
|
if (typeof setTimeout === 'function') {
|
||
|
cachedSetTimeout = setTimeout;
|
||
|
} else {
|
||
|
cachedSetTimeout = defaultSetTimout;
|
||
|
}
|
||
|
} catch (e) {
|
||
|
cachedSetTimeout = defaultSetTimout;
|
||
|
}
|
||
|
try {
|
||
|
if (typeof clearTimeout === 'function') {
|
||
|
cachedClearTimeout = clearTimeout;
|
||
|
} else {
|
||
|
cachedClearTimeout = defaultClearTimeout;
|
||
|
}
|
||
|
} catch (e) {
|
||
|
cachedClearTimeout = defaultClearTimeout;
|
||
|
}
|
||
|
} ())
|
||
|
function runTimeout(fun) {
|
||
|
if (cachedSetTimeout === setTimeout) {
|
||
|
//normal enviroments in sane situations
|
||
|
return setTimeout(fun, 0);
|
||
|
}
|
||
|
// if setTimeout wasn't available but was latter defined
|
||
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
||
|
cachedSetTimeout = setTimeout;
|
||
|
return setTimeout(fun, 0);
|
||
|
}
|
||
|
try {
|
||
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||
|
return cachedSetTimeout(fun, 0);
|
||
|
} catch(e){
|
||
|
try {
|
||
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||
|
return cachedSetTimeout.call(null, fun, 0);
|
||
|
} catch(e){
|
||
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||
|
return cachedSetTimeout.call(this, fun, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
function runClearTimeout(marker) {
|
||
|
if (cachedClearTimeout === clearTimeout) {
|
||
|
//normal enviroments in sane situations
|
||
|
return clearTimeout(marker);
|
||
|
}
|
||
|
// if clearTimeout wasn't available but was latter defined
|
||
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||
|
cachedClearTimeout = clearTimeout;
|
||
|
return clearTimeout(marker);
|
||
|
}
|
||
|
try {
|
||
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||
|
return cachedClearTimeout(marker);
|
||
|
} catch (e){
|
||
|
try {
|
||
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||
|
return cachedClearTimeout.call(null, marker);
|
||
|
} catch (e){
|
||
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||
|
return cachedClearTimeout.call(this, marker);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
var queue = [];
|
||
|
var draining = false;
|
||
|
var currentQueue;
|
||
|
var queueIndex = -1;
|
||
|
|
||
|
function cleanUpNextTick() {
|
||
|
if (!draining || !currentQueue) {
|
||
|
return;
|
||
|
}
|
||
|
draining = false;
|
||
|
if (currentQueue.length) {
|
||
|
queue = currentQueue.concat(queue);
|
||
|
} else {
|
||
|
queueIndex = -1;
|
||
|
}
|
||
|
if (queue.length) {
|
||
|
drainQueue();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function drainQueue() {
|
||
|
if (draining) {
|
||
|
return;
|
||
|
}
|
||
|
var timeout = runTimeout(cleanUpNextTick);
|
||
|
draining = true;
|
||
|
|
||
|
var len = queue.length;
|
||
|
while(len) {
|
||
|
currentQueue = queue;
|
||
|
queue = [];
|
||
|
while (++queueIndex < len) {
|
||
|
if (currentQueue) {
|
||
|
currentQueue[queueIndex].run();
|
||
|
}
|
||
|
}
|
||
|
queueIndex = -1;
|
||
|
len = queue.length;
|
||
|
}
|
||
|
currentQueue = null;
|
||
|
draining = false;
|
||
|
runClearTimeout(timeout);
|
||
|
}
|
||
|
|
||
|
process.nextTick = function (fun) {
|
||
|
var args = new Array(arguments.length - 1);
|
||
|
if (arguments.length > 1) {
|
||
|
for (var i = 1; i < arguments.length; i++) {
|
||
|
args[i - 1] = arguments[i];
|
||
|
}
|
||
|
}
|
||
|
queue.push(new Item(fun, args));
|
||
|
if (queue.length === 1 && !draining) {
|
||
|
runTimeout(drainQueue);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// v8 likes predictible objects
|
||
|
function Item(fun, array) {
|
||
|
this.fun = fun;
|
||
|
this.array = array;
|
||
|
}
|
||
|
Item.prototype.run = function () {
|
||
|
this.fun.apply(null, this.array);
|
||
|
};
|
||
|
process.title = 'browser';
|
||
|
process.browser = true;
|
||
|
process.env = {};
|
||
|
process.argv = [];
|
||
|
process.version = ''; // empty string to avoid regexp issues
|
||
|
process.versions = {};
|
||
|
|
||
|
function noop() {}
|
||
|
|
||
|
process.on = noop;
|
||
|
process.addListener = noop;
|
||
|
process.once = noop;
|
||
|
process.off = noop;
|
||
|
process.removeListener = noop;
|
||
|
process.removeAllListeners = noop;
|
||
|
process.emit = noop;
|
||
|
process.prependListener = noop;
|
||
|
process.prependOnceListener = noop;
|
||
|
|
||
|
process.listeners = function (name) { return [] }
|
||
|
|
||
|
process.binding = function (name) {
|
||
|
throw new Error('process.binding is not supported');
|
||
|
};
|
||
|
|
||
|
process.cwd = function () { return '/' };
|
||
|
process.chdir = function (dir) {
|
||
|
throw new Error('process.chdir is not supported');
|
||
|
};
|
||
|
process.umask = function() { return 0; };
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 11 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
module.exports = function isBuffer(arg) {
|
||
|
return arg && typeof arg === 'object'
|
||
|
&& typeof arg.copy === 'function'
|
||
|
&& typeof arg.fill === 'function'
|
||
|
&& typeof arg.readUInt8 === 'function';
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
/* 12 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
if (typeof Object.create === 'function') {
|
||
|
// implementation from standard node.js 'util' module
|
||
|
module.exports = function inherits(ctor, superCtor) {
|
||
|
ctor.super_ = superCtor
|
||
|
ctor.prototype = Object.create(superCtor.prototype, {
|
||
|
constructor: {
|
||
|
value: ctor,
|
||
|
enumerable: false,
|
||
|
writable: true,
|
||
|
configurable: true
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
} else {
|
||
|
// old school shim for old browsers
|
||
|
module.exports = function inherits(ctor, superCtor) {
|
||
|
ctor.super_ = superCtor
|
||
|
var TempCtor = function () {}
|
||
|
TempCtor.prototype = superCtor.prototype
|
||
|
ctor.prototype = new TempCtor()
|
||
|
ctor.prototype.constructor = ctor
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 13 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/*!
|
||
|
* 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 = __webpack_require__(14);
|
||
|
|
||
|
function getPublicSuffix(domain) {
|
||
|
return psl.get(domain);
|
||
|
}
|
||
|
|
||
|
exports.getPublicSuffix = getPublicSuffix;
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 14 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/*eslint no-var:0, prefer-arrow-callback: 0, object-shorthand: 0 */
|
||
|
'use strict';
|
||
|
|
||
|
|
||
|
var Punycode = __webpack_require__(15);
|
||
|
|
||
|
|
||
|
var internals = {};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Read rules from file.
|
||
|
//
|
||
|
internals.rules = __webpack_require__(16).map(function (rule) {
|
||
|
|
||
|
return {
|
||
|
rule: rule,
|
||
|
suffix: rule.replace(/^(\*\.|\!)/, ''),
|
||
|
punySuffix: -1,
|
||
|
wildcard: rule.charAt(0) === '*',
|
||
|
exception: rule.charAt(0) === '!'
|
||
|
};
|
||
|
});
|
||
|
|
||
|
|
||
|
//
|
||
|
// Check is given string ends with `suffix`.
|
||
|
//
|
||
|
internals.endsWith = function (str, suffix) {
|
||
|
|
||
|
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
||
|
};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Find rule for a given domain.
|
||
|
//
|
||
|
internals.findRule = function (domain) {
|
||
|
|
||
|
var punyDomain = Punycode.toASCII(domain);
|
||
|
return internals.rules.reduce(function (memo, rule) {
|
||
|
|
||
|
if (rule.punySuffix === -1){
|
||
|
rule.punySuffix = Punycode.toASCII(rule.suffix);
|
||
|
}
|
||
|
if (!internals.endsWith(punyDomain, '.' + rule.punySuffix) && punyDomain !== rule.punySuffix) {
|
||
|
return memo;
|
||
|
}
|
||
|
// This has been commented out as it never seems to run. This is because
|
||
|
// sub tlds always appear after their parents and we never find a shorter
|
||
|
// match.
|
||
|
//if (memo) {
|
||
|
// var memoSuffix = Punycode.toASCII(memo.suffix);
|
||
|
// if (memoSuffix.length >= punySuffix.length) {
|
||
|
// return memo;
|
||
|
// }
|
||
|
//}
|
||
|
return rule;
|
||
|
}, null);
|
||
|
};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Error codes and messages.
|
||
|
//
|
||
|
exports.errorCodes = {
|
||
|
DOMAIN_TOO_SHORT: 'Domain name too short.',
|
||
|
DOMAIN_TOO_LONG: 'Domain name too long. It should be no more than 255 chars.',
|
||
|
LABEL_STARTS_WITH_DASH: 'Domain name label can not start with a dash.',
|
||
|
LABEL_ENDS_WITH_DASH: 'Domain name label can not end with a dash.',
|
||
|
LABEL_TOO_LONG: 'Domain name label should be at most 63 chars long.',
|
||
|
LABEL_TOO_SHORT: 'Domain name label should be at least 1 character long.',
|
||
|
LABEL_INVALID_CHARS: 'Domain name label can only contain alphanumeric characters or dashes.'
|
||
|
};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Validate domain name and throw if not valid.
|
||
|
//
|
||
|
// From wikipedia:
|
||
|
//
|
||
|
// Hostnames are composed of series of labels concatenated with dots, as are all
|
||
|
// domain names. Each label must be between 1 and 63 characters long, and the
|
||
|
// entire hostname (including the delimiting dots) has a maximum of 255 chars.
|
||
|
//
|
||
|
// Allowed chars:
|
||
|
//
|
||
|
// * `a-z`
|
||
|
// * `0-9`
|
||
|
// * `-` but not as a starting or ending character
|
||
|
// * `.` as a separator for the textual portions of a domain name
|
||
|
//
|
||
|
// * http://en.wikipedia.org/wiki/Domain_name
|
||
|
// * http://en.wikipedia.org/wiki/Hostname
|
||
|
//
|
||
|
internals.validate = function (input) {
|
||
|
|
||
|
// Before we can validate we need to take care of IDNs with unicode chars.
|
||
|
var ascii = Punycode.toASCII(input);
|
||
|
|
||
|
if (ascii.length < 1) {
|
||
|
return 'DOMAIN_TOO_SHORT';
|
||
|
}
|
||
|
if (ascii.length > 255) {
|
||
|
return 'DOMAIN_TOO_LONG';
|
||
|
}
|
||
|
|
||
|
// Check each part's length and allowed chars.
|
||
|
var labels = ascii.split('.');
|
||
|
var label;
|
||
|
|
||
|
for (var i = 0; i < labels.length; ++i) {
|
||
|
label = labels[i];
|
||
|
if (!label.length) {
|
||
|
return 'LABEL_TOO_SHORT';
|
||
|
}
|
||
|
if (label.length > 63) {
|
||
|
return 'LABEL_TOO_LONG';
|
||
|
}
|
||
|
if (label.charAt(0) === '-') {
|
||
|
return 'LABEL_STARTS_WITH_DASH';
|
||
|
}
|
||
|
if (label.charAt(label.length - 1) === '-') {
|
||
|
return 'LABEL_ENDS_WITH_DASH';
|
||
|
}
|
||
|
if (!/^[a-z0-9\-]+$/.test(label)) {
|
||
|
return 'LABEL_INVALID_CHARS';
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Public API
|
||
|
//
|
||
|
|
||
|
|
||
|
//
|
||
|
// Parse domain.
|
||
|
//
|
||
|
exports.parse = function (input) {
|
||
|
|
||
|
if (typeof input !== 'string') {
|
||
|
throw new TypeError('Domain name must be a string.');
|
||
|
}
|
||
|
|
||
|
// Force domain to lowercase.
|
||
|
var domain = input.slice(0).toLowerCase();
|
||
|
|
||
|
// Handle FQDN.
|
||
|
// TODO: Simply remove trailing dot?
|
||
|
if (domain.charAt(domain.length - 1) === '.') {
|
||
|
domain = domain.slice(0, domain.length - 1);
|
||
|
}
|
||
|
|
||
|
// Validate and sanitise input.
|
||
|
var error = internals.validate(domain);
|
||
|
if (error) {
|
||
|
return {
|
||
|
input: input,
|
||
|
error: {
|
||
|
message: exports.errorCodes[error],
|
||
|
code: error
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
var parsed = {
|
||
|
input: input,
|
||
|
tld: null,
|
||
|
sld: null,
|
||
|
domain: null,
|
||
|
subdomain: null,
|
||
|
listed: false
|
||
|
};
|
||
|
|
||
|
var domainParts = domain.split('.');
|
||
|
|
||
|
// Non-Internet TLD
|
||
|
if (domainParts[domainParts.length - 1] === 'local') {
|
||
|
return parsed;
|
||
|
}
|
||
|
|
||
|
var handlePunycode = function () {
|
||
|
|
||
|
if (!/xn--/.test(domain)) {
|
||
|
return parsed;
|
||
|
}
|
||
|
if (parsed.domain) {
|
||
|
parsed.domain = Punycode.toASCII(parsed.domain);
|
||
|
}
|
||
|
if (parsed.subdomain) {
|
||
|
parsed.subdomain = Punycode.toASCII(parsed.subdomain);
|
||
|
}
|
||
|
return parsed;
|
||
|
};
|
||
|
|
||
|
var rule = internals.findRule(domain);
|
||
|
|
||
|
// Unlisted tld.
|
||
|
if (!rule) {
|
||
|
if (domainParts.length < 2) {
|
||
|
return parsed;
|
||
|
}
|
||
|
parsed.tld = domainParts.pop();
|
||
|
parsed.sld = domainParts.pop();
|
||
|
parsed.domain = [parsed.sld, parsed.tld].join('.');
|
||
|
if (domainParts.length) {
|
||
|
parsed.subdomain = domainParts.pop();
|
||
|
}
|
||
|
return handlePunycode();
|
||
|
}
|
||
|
|
||
|
// At this point we know the public suffix is listed.
|
||
|
parsed.listed = true;
|
||
|
|
||
|
var tldParts = rule.suffix.split('.');
|
||
|
var privateParts = domainParts.slice(0, domainParts.length - tldParts.length);
|
||
|
|
||
|
if (rule.exception) {
|
||
|
privateParts.push(tldParts.shift());
|
||
|
}
|
||
|
|
||
|
parsed.tld = tldParts.join('.');
|
||
|
|
||
|
if (!privateParts.length) {
|
||
|
return handlePunycode();
|
||
|
}
|
||
|
|
||
|
if (rule.wildcard) {
|
||
|
tldParts.unshift(privateParts.pop());
|
||
|
parsed.tld = tldParts.join('.');
|
||
|
}
|
||
|
|
||
|
if (!privateParts.length) {
|
||
|
return handlePunycode();
|
||
|
}
|
||
|
|
||
|
parsed.sld = privateParts.pop();
|
||
|
parsed.domain = [parsed.sld, parsed.tld].join('.');
|
||
|
|
||
|
if (privateParts.length) {
|
||
|
parsed.subdomain = privateParts.join('.');
|
||
|
}
|
||
|
|
||
|
return handlePunycode();
|
||
|
};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Get domain.
|
||
|
//
|
||
|
exports.get = function (domain) {
|
||
|
|
||
|
if (!domain) {
|
||
|
return null;
|
||
|
}
|
||
|
return exports.parse(domain).domain || null;
|
||
|
};
|
||
|
|
||
|
|
||
|
//
|
||
|
// Check whether domain belongs to a known public suffix.
|
||
|
//
|
||
|
exports.isValid = function (domain) {
|
||
|
|
||
|
var parsed = exports.parse(domain);
|
||
|
return Boolean(parsed.domain && parsed.listed);
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 15 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.4.1 by @mathias */
|
||
|
;(function(root) {
|
||
|
|
||
|
/** Detect free variables */
|
||
|
var freeExports = typeof exports == 'object' && exports &&
|
||
|
!exports.nodeType && exports;
|
||
|
var freeModule = typeof module == 'object' && module &&
|
||
|
!module.nodeType && module;
|
||
|
var freeGlobal = typeof global == 'object' && global;
|
||
|
if (
|
||
|
freeGlobal.global === freeGlobal ||
|
||
|
freeGlobal.window === freeGlobal ||
|
||
|
freeGlobal.self === freeGlobal
|
||
|
) {
|
||
|
root = freeGlobal;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The `punycode` object.
|
||
|
* @name punycode
|
||
|
* @type Object
|
||
|
*/
|
||
|
var punycode,
|
||
|
|
||
|
/** Highest positive signed 32-bit float value */
|
||
|
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
||
|
|
||
|
/** Bootstring parameters */
|
||
|
base = 36,
|
||
|
tMin = 1,
|
||
|
tMax = 26,
|
||
|
skew = 38,
|
||
|
damp = 700,
|
||
|
initialBias = 72,
|
||
|
initialN = 128, // 0x80
|
||
|
delimiter = '-', // '\x2D'
|
||
|
|
||
|
/** Regular expressions */
|
||
|
regexPunycode = /^xn--/,
|
||
|
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
||
|
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
||
|
|
||
|
/** Error messages */
|
||
|
errors = {
|
||
|
'overflow': 'Overflow: input needs wider integers to process',
|
||
|
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||
|
'invalid-input': 'Invalid input'
|
||
|
},
|
||
|
|
||
|
/** Convenience shortcuts */
|
||
|
baseMinusTMin = base - tMin,
|
||
|
floor = Math.floor,
|
||
|
stringFromCharCode = String.fromCharCode,
|
||
|
|
||
|
/** Temporary variable */
|
||
|
key;
|
||
|
|
||
|
/*--------------------------------------------------------------------------*/
|
||
|
|
||
|
/**
|
||
|
* A generic error utility function.
|
||
|
* @private
|
||
|
* @param {String} type The error type.
|
||
|
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||
|
*/
|
||
|
function error(type) {
|
||
|
throw new RangeError(errors[type]);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A generic `Array#map` utility function.
|
||
|
* @private
|
||
|
* @param {Array} array The array to iterate over.
|
||
|
* @param {Function} callback The function that gets called for every array
|
||
|
* item.
|
||
|
* @returns {Array} A new array of values returned by the callback function.
|
||
|
*/
|
||
|
function map(array, fn) {
|
||
|
var length = array.length;
|
||
|
var result = [];
|
||
|
while (length--) {
|
||
|
result[length] = fn(array[length]);
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||
|
* addresses.
|
||
|
* @private
|
||
|
* @param {String} domain The domain name or email address.
|
||
|
* @param {Function} callback The function that gets called for every
|
||
|
* character.
|
||
|
* @returns {Array} A new string of characters returned by the callback
|
||
|
* function.
|
||
|
*/
|
||
|
function mapDomain(string, fn) {
|
||
|
var parts = string.split('@');
|
||
|
var result = '';
|
||
|
if (parts.length > 1) {
|
||
|
// In email addresses, only the domain name should be punycoded. Leave
|
||
|
// the local part (i.e. everything up to `@`) intact.
|
||
|
result = parts[0] + '@';
|
||
|
string = parts[1];
|
||
|
}
|
||
|
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||
|
string = string.replace(regexSeparators, '\x2E');
|
||
|
var labels = string.split('.');
|
||
|
var encoded = map(labels, fn).join('.');
|
||
|
return result + encoded;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates an array containing the numeric code points of each Unicode
|
||
|
* character in the string. While JavaScript uses UCS-2 internally,
|
||
|
* this function will convert a pair of surrogate halves (each of which
|
||
|
* UCS-2 exposes as separate characters) into a single code point,
|
||
|
* matching UTF-16.
|
||
|
* @see `punycode.ucs2.encode`
|
||
|
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||
|
* @memberOf punycode.ucs2
|
||
|
* @name decode
|
||
|
* @param {String} string The Unicode input string (UCS-2).
|
||
|
* @returns {Array} The new array of code points.
|
||
|
*/
|
||
|
function ucs2decode(string) {
|
||
|
var output = [],
|
||
|
counter = 0,
|
||
|
length = string.length,
|
||
|
value,
|
||
|
extra;
|
||
|
while (counter < length) {
|
||
|
value = string.charCodeAt(counter++);
|
||
|
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||
|
// high surrogate, and there is a next character
|
||
|
extra = string.charCodeAt(counter++);
|
||
|
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
||
|
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||
|
} else {
|
||
|
// unmatched surrogate; only append this code unit, in case the next
|
||
|
// code unit is the high surrogate of a surrogate pair
|
||
|
output.push(value);
|
||
|
counter--;
|
||
|
}
|
||
|
} else {
|
||
|
output.push(value);
|
||
|
}
|
||
|
}
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates a string based on an array of numeric code points.
|
||
|
* @see `punycode.ucs2.decode`
|
||
|
* @memberOf punycode.ucs2
|
||
|
* @name encode
|
||
|
* @param {Array} codePoints The array of numeric code points.
|
||
|
* @returns {String} The new Unicode string (UCS-2).
|
||
|
*/
|
||
|
function ucs2encode(array) {
|
||
|
return map(array, function(value) {
|
||
|
var output = '';
|
||
|
if (value > 0xFFFF) {
|
||
|
value -= 0x10000;
|
||
|
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
||
|
value = 0xDC00 | value & 0x3FF;
|
||
|
}
|
||
|
output += stringFromCharCode(value);
|
||
|
return output;
|
||
|
}).join('');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a basic code point into a digit/integer.
|
||
|
* @see `digitToBasic()`
|
||
|
* @private
|
||
|
* @param {Number} codePoint The basic numeric code point value.
|
||
|
* @returns {Number} The numeric value of a basic code point (for use in
|
||
|
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||
|
* the code point does not represent a value.
|
||
|
*/
|
||
|
function basicToDigit(codePoint) {
|
||
|
if (codePoint - 48 < 10) {
|
||
|
return codePoint - 22;
|
||
|
}
|
||
|
if (codePoint - 65 < 26) {
|
||
|
return codePoint - 65;
|
||
|
}
|
||
|
if (codePoint - 97 < 26) {
|
||
|
return codePoint - 97;
|
||
|
}
|
||
|
return base;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a digit/integer into a basic code point.
|
||
|
* @see `basicToDigit()`
|
||
|
* @private
|
||
|
* @param {Number} digit The numeric value of a basic code point.
|
||
|
* @returns {Number} The basic code point whose value (when used for
|
||
|
* representing integers) is `digit`, which needs to be in the range
|
||
|
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||
|
* used; else, the lowercase form is used. The behavior is undefined
|
||
|
* if `flag` is non-zero and `digit` has no uppercase form.
|
||
|
*/
|
||
|
function digitToBasic(digit, flag) {
|
||
|
// 0..25 map to ASCII a..z or A..Z
|
||
|
// 26..35 map to ASCII 0..9
|
||
|
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||
|
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||
|
* @private
|
||
|
*/
|
||
|
function adapt(delta, numPoints, firstTime) {
|
||
|
var k = 0;
|
||
|
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||
|
delta += floor(delta / numPoints);
|
||
|
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||
|
delta = floor(delta / baseMinusTMin);
|
||
|
}
|
||
|
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||
|
* symbols.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The Punycode string of ASCII-only symbols.
|
||
|
* @returns {String} The resulting string of Unicode symbols.
|
||
|
*/
|
||
|
function decode(input) {
|
||
|
// Don't use UCS-2
|
||
|
var output = [],
|
||
|
inputLength = input.length,
|
||
|
out,
|
||
|
i = 0,
|
||
|
n = initialN,
|
||
|
bias = initialBias,
|
||
|
basic,
|
||
|
j,
|
||
|
index,
|
||
|
oldi,
|
||
|
w,
|
||
|
k,
|
||
|
digit,
|
||
|
t,
|
||
|
/** Cached calculation results */
|
||
|
baseMinusT;
|
||
|
|
||
|
// Handle the basic code points: let `basic` be the number of input code
|
||
|
// points before the last delimiter, or `0` if there is none, then copy
|
||
|
// the first basic code points to the output.
|
||
|
|
||
|
basic = input.lastIndexOf(delimiter);
|
||
|
if (basic < 0) {
|
||
|
basic = 0;
|
||
|
}
|
||
|
|
||
|
for (j = 0; j < basic; ++j) {
|
||
|
// if it's not a basic code point
|
||
|
if (input.charCodeAt(j) >= 0x80) {
|
||
|
error('not-basic');
|
||
|
}
|
||
|
output.push(input.charCodeAt(j));
|
||
|
}
|
||
|
|
||
|
// Main decoding loop: start just after the last delimiter if any basic code
|
||
|
// points were copied; start at the beginning otherwise.
|
||
|
|
||
|
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||
|
|
||
|
// `index` is the index of the next character to be consumed.
|
||
|
// Decode a generalized variable-length integer into `delta`,
|
||
|
// which gets added to `i`. The overflow checking is easier
|
||
|
// if we increase `i` as we go, then subtract off its starting
|
||
|
// value at the end to obtain `delta`.
|
||
|
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
||
|
|
||
|
if (index >= inputLength) {
|
||
|
error('invalid-input');
|
||
|
}
|
||
|
|
||
|
digit = basicToDigit(input.charCodeAt(index++));
|
||
|
|
||
|
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
i += digit * w;
|
||
|
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||
|
|
||
|
if (digit < t) {
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
baseMinusT = base - t;
|
||
|
if (w > floor(maxInt / baseMinusT)) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
w *= baseMinusT;
|
||
|
|
||
|
}
|
||
|
|
||
|
out = output.length + 1;
|
||
|
bias = adapt(i - oldi, out, oldi == 0);
|
||
|
|
||
|
// `i` was supposed to wrap around from `out` to `0`,
|
||
|
// incrementing `n` each time, so we'll fix that now:
|
||
|
if (floor(i / out) > maxInt - n) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
n += floor(i / out);
|
||
|
i %= out;
|
||
|
|
||
|
// Insert `n` at position `i` of the output
|
||
|
output.splice(i++, 0, n);
|
||
|
|
||
|
}
|
||
|
|
||
|
return ucs2encode(output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||
|
* Punycode string of ASCII-only symbols.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The string of Unicode symbols.
|
||
|
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||
|
*/
|
||
|
function encode(input) {
|
||
|
var n,
|
||
|
delta,
|
||
|
handledCPCount,
|
||
|
basicLength,
|
||
|
bias,
|
||
|
j,
|
||
|
m,
|
||
|
q,
|
||
|
k,
|
||
|
t,
|
||
|
currentValue,
|
||
|
output = [],
|
||
|
/** `inputLength` will hold the number of code points in `input`. */
|
||
|
inputLength,
|
||
|
/** Cached calculation results */
|
||
|
handledCPCountPlusOne,
|
||
|
baseMinusT,
|
||
|
qMinusT;
|
||
|
|
||
|
// Convert the input in UCS-2 to Unicode
|
||
|
input = ucs2decode(input);
|
||
|
|
||
|
// Cache the length
|
||
|
inputLength = input.length;
|
||
|
|
||
|
// Initialize the state
|
||
|
n = initialN;
|
||
|
delta = 0;
|
||
|
bias = initialBias;
|
||
|
|
||
|
// Handle the basic code points
|
||
|
for (j = 0; j < inputLength; ++j) {
|
||
|
currentValue = input[j];
|
||
|
if (currentValue < 0x80) {
|
||
|
output.push(stringFromCharCode(currentValue));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
handledCPCount = basicLength = output.length;
|
||
|
|
||
|
// `handledCPCount` is the number of code points that have been handled;
|
||
|
// `basicLength` is the number of basic code points.
|
||
|
|
||
|
// Finish the basic string - if it is not empty - with a delimiter
|
||
|
if (basicLength) {
|
||
|
output.push(delimiter);
|
||
|
}
|
||
|
|
||
|
// Main encoding loop:
|
||
|
while (handledCPCount < inputLength) {
|
||
|
|
||
|
// All non-basic code points < n have been handled already. Find the next
|
||
|
// larger one:
|
||
|
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
||
|
currentValue = input[j];
|
||
|
if (currentValue >= n && currentValue < m) {
|
||
|
m = currentValue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||
|
// but guard against overflow
|
||
|
handledCPCountPlusOne = handledCPCount + 1;
|
||
|
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
delta += (m - n) * handledCPCountPlusOne;
|
||
|
n = m;
|
||
|
|
||
|
for (j = 0; j < inputLength; ++j) {
|
||
|
currentValue = input[j];
|
||
|
|
||
|
if (currentValue < n && ++delta > maxInt) {
|
||
|
error('overflow');
|
||
|
}
|
||
|
|
||
|
if (currentValue == n) {
|
||
|
// Represent delta as a generalized variable-length integer
|
||
|
for (q = delta, k = base; /* no condition */; k += base) {
|
||
|
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||
|
if (q < t) {
|
||
|
break;
|
||
|
}
|
||
|
qMinusT = q - t;
|
||
|
baseMinusT = base - t;
|
||
|
output.push(
|
||
|
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||
|
);
|
||
|
q = floor(qMinusT / baseMinusT);
|
||
|
}
|
||
|
|
||
|
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||
|
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
||
|
delta = 0;
|
||
|
++handledCPCount;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
++delta;
|
||
|
++n;
|
||
|
|
||
|
}
|
||
|
return output.join('');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a Punycode string representing a domain name or an email address
|
||
|
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||
|
* it doesn't matter if you call it on a string that has already been
|
||
|
* converted to Unicode.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The Punycoded domain name or email address to
|
||
|
* convert to Unicode.
|
||
|
* @returns {String} The Unicode representation of the given Punycode
|
||
|
* string.
|
||
|
*/
|
||
|
function toUnicode(input) {
|
||
|
return mapDomain(input, function(string) {
|
||
|
return regexPunycode.test(string)
|
||
|
? decode(string.slice(4).toLowerCase())
|
||
|
: string;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Converts a Unicode string representing a domain name or an email address to
|
||
|
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||
|
* i.e. it doesn't matter if you call it with a domain that's already in
|
||
|
* ASCII.
|
||
|
* @memberOf punycode
|
||
|
* @param {String} input The domain name or email address to convert, as a
|
||
|
* Unicode string.
|
||
|
* @returns {String} The Punycode representation of the given domain name or
|
||
|
* email address.
|
||
|
*/
|
||
|
function toASCII(input) {
|
||
|
return mapDomain(input, function(string) {
|
||
|
return regexNonASCII.test(string)
|
||
|
? 'xn--' + encode(string)
|
||
|
: string;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/*--------------------------------------------------------------------------*/
|
||
|
|
||
|
/** Define the public API */
|
||
|
punycode = {
|
||
|
/**
|
||
|
* A string representing the current Punycode.js version number.
|
||
|
* @memberOf punycode
|
||
|
* @type String
|
||
|
*/
|
||
|
'version': '1.4.1',
|
||
|
/**
|
||
|
* An object of methods to convert from JavaScript's internal character
|
||
|
* representation (UCS-2) to Unicode code points, and back.
|
||
|
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||
|
* @memberOf punycode
|
||
|
* @type Object
|
||
|
*/
|
||
|
'ucs2': {
|
||
|
'decode': ucs2decode,
|
||
|
'encode': ucs2encode
|
||
|
},
|
||
|
'decode': decode,
|
||
|
'encode': encode,
|
||
|
'toASCII': toASCII,
|
||
|
'toUnicode': toUnicode
|
||
|
};
|
||
|
|
||
|
/** Expose `punycode` */
|
||
|
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
||
|
// like the following:
|
||
|
if (
|
||
|
true
|
||
|
) {
|
||
|
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
||
|
return punycode;
|
||
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
|
} else if (freeExports && freeModule) {
|
||
|
if (module.exports == freeExports) {
|
||
|
// in Node.js, io.js, or RingoJS v0.8.0+
|
||
|
freeModule.exports = punycode;
|
||
|
} else {
|
||
|
// in Narwhal or RingoJS v0.7.0-
|
||
|
for (key in punycode) {
|
||
|
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
// in Rhino or a web browser
|
||
|
root.punycode = punycode;
|
||
|
}
|
||
|
|
||
|
}(this));
|
||
|
|
||
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)(module), (function() { return this; }())))
|
||
|
|
||
|
/***/ }),
|
||
|
/* 16 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
module.exports = ["ac","com.ac","edu.ac","gov.ac","net.ac","mil.ac","org.ac","ad","nom.ad","ae","co.ae","net.ae","org.ae","sch.ae","ac.ae","gov.ae","mil.ae","aero","accident-investigation.aero","accident-prevention.aero","aerobatic.aero","aeroclub.aero","aerodrome.aero","agents.aero","aircraft.aero","airline.aero","airport.aero","air-surveillance.aero","airtraffic.aero","air-traffic-control.aero","ambulance.aero","amusement.aero","association.aero","author.aero","ballooning.aero","broker.aero","caa.aero","cargo.aero","catering.aero","certification.aero","championship.aero","charter.aero","civilaviation.aero","club.aero","conference.aero","consultant.aero","consulting.aero","control.aero","council.aero","crew.aero","design.aero","dgca.aero","educator.aero","emergency.aero","engine.aero","engineer.aero","entertainment.aero","equipment.aero","exchange.aero","express.aero","federation.aero","flight.aero","freight.aero","fuel.aero","gliding.aero","government.aero","groundhandling.aero","group.aero","hanggliding.aero","homebuilt.aero","insurance.aero","journal.aero","journalist.aero","leasing.aero","logistics.aero","magazine.aero","maintenance.aero","media.aero","microlight.aero","modelling.aero","navigation.aero","parachuting.aero","paragliding.aero","passenger-association.aero","pilot.aero","press.aero","production.aero","recreation.aero","repbody.aero","res.aero","research.aero","rotorcraft.aero","safety.aero","scientist.aero","services.aero","show.aero","skydiving.aero","software.aero","student.aero","trader.aero","trading.aero","trainer.aero","union.aero","workinggroup.aero","works.aero","af","gov.af","com.af","org.af","net.af","edu.af","ag","com.ag","org.ag","net.ag","co.ag","nom.ag","ai","off.ai","com.ai","net.ai","org.ai","al","com.al","edu.al","gov.al","mil.al","net.al","org.al","am","ao","ed.ao","gv.ao","og.ao","co.ao","pb.ao","it.ao","aq","ar","com.ar","edu.ar","gob.ar","gov.ar","int.ar","mil.ar","musica.ar","net.ar","org.ar","tur.ar","arpa","e164.arpa","in-addr.arpa","ip6.arpa","iris.arpa","uri.arpa","urn.arpa","as","gov.as","asia","at","ac.at","co.at","gv.at","or.at","au","com.au","net.au","org.au","edu.au","gov.au","asn.au","id.au","info.au","conf.au","oz.au","act.au","nsw.au","nt.au","qld.au","sa.au","tas.au","vic.au","wa.au","act.edu.au","nsw.edu.au","nt.edu.au","qld.edu.au","sa.edu.au","tas.edu.au","vic.edu.au","wa.edu.au","qld.gov.au","sa.gov.au","tas.gov.au","vic.gov.au","wa.gov.au","aw","com.aw","ax","az","com.az","net.az","int.az","gov.az","org.az","edu.az","info.az","pp.az","mil.az","name.az","pro.az","biz.az","ba","com.ba","edu.ba","gov.ba","mil.ba","net.ba","org.ba","bb","biz.bb","co.bb","com.bb","edu.bb","gov.bb","info.bb","net.bb","org.bb","store.bb","tv.bb","*.bd","be","ac.be","bf","gov.bf","bg","a.bg","b.bg","c.bg","d.bg","e.bg","f.bg","g.bg","h.bg","i.bg","j.bg","k.bg","l.bg","m.bg","n.bg","o.bg","p.bg","q.bg","r.bg","s.bg","t.bg","u.bg","v.bg","w.bg","x.bg","y.bg","z.bg","0.bg","1.bg","2.bg","3.bg","4.bg","5.bg","6.bg","7.bg","8.bg","9.bg","bh","com.bh","edu.bh","net.bh","org.bh","gov.bh","bi","co.bi","com.bi","edu.bi","or.bi","org.bi","biz","bj","asso.bj","barreau.bj","gouv.bj","bm","com.bm","edu.bm","gov.bm","net.bm","org.bm","*.bn","bo","com.bo","edu.bo","gob.bo","int.bo","org.bo","net.bo","mil.bo","tv.bo","web.bo","academia.bo","agro.bo","arte.bo","blog.bo","bolivia.bo","ciencia.bo","cooperativa.bo","democracia.bo","deporte.bo","ecologia.bo","economia.bo","empresa.bo","indigena.bo","industria.bo","info.bo","medicina.bo","movimiento.bo","musica.bo","natural.bo","nombre.bo","noticias.bo","patria.bo","politica.bo","profesional.bo","plurinacional.bo","pueblo.bo","revista.bo","salud.bo","tecnologia.bo","tksat.bo","transporte.bo","wiki.bo","br","9guacu.br","abc.br","adm.br","adv.br","agr.br","aju.br","am.br","anani.br","aparecida.br","arq.br","art.br","ato.br","b.br","barueri.br","belem.br","bhz.br","bio.br","blog.br","bmd.br","boavista.br","bsb.br","campinagrande.br","campinas.br","caxias.br","cim.br","cng.br","cnt.br","com.br","contagem.br","coop.br","cri.br","cuiaba.br","curitiba.br","def.br","
|
||
|
|
||
|
/***/ }),
|
||
|
/* 17 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
/*!
|
||
|
* 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.getAllCookies = function(cb) {
|
||
|
throw new Error('getAllCookies is not implemented (therefore jar cannot be serialized)');
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 18 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/*!
|
||
|
* 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 = __webpack_require__(17).Store;
|
||
|
var permuteDomain = __webpack_require__(19).permuteDomain;
|
||
|
var pathMatch = __webpack_require__(20).pathMatch;
|
||
|
var util = __webpack_require__(9);
|
||
|
|
||
|
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.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);
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 19 */
|
||
|
/***/ (function(module, exports, __webpack_require__) {
|
||
|
|
||
|
/*!
|
||
|
* 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 = __webpack_require__(13);
|
||
|
|
||
|
// 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;
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 20 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
/*!
|
||
|
* 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;
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
/* 21 */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
module.exports = {"_from":"tough-cookie@2.4.3","_id":"tough-cookie@2.4.3","_inBundle":false,"_integrity":"sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==","_location":"/tough-cookie","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"tough-cookie@2.4.3","name":"tough-cookie","escapedName":"tough-cookie","rawSpec":"2.4.3","saveSpec":null,"fetchSpec":"2.4.3"},"_requiredBy":["#DEV:/"],"_resolved":"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz","_shasum":"53f36da3f47783b0925afa06ff9f3b165280f781","_spec":"tough-cookie@2.4.3","_where":"/Users/sefa/Entwicklung/umd-tough-cookie","author":{"name":"Jeremy Stashewsky","email":"jstash@gmail.com"},"bugs":{"url":"https://github.com/salesforce/tough-cookie/issues"},"bundleDependencies":false,"contributors":[{"name":"Alexander Savin"},{"name":"Ian Livingstone"},{"name":"Ivan Nikulin"},{"name":"Lalit Kapoor"},{"name":"Sam Thompson"},{"name":"Sebastian Mayr"}],"dependencies":{"psl":"^1.1.24","punycode":"^1.4.1"},"deprecated":false,"description":"RFC6265 Cookies and Cookie Jar for node.js","devDependencies":{"async":"^1.4.2","nyc":"^11.6.0","string.prototype.repeat":"^0.2.0","vows":"^0.8.1"},"engines":{"node":">=0.8"},"files":["lib"],"homepage":"https://github.com/salesforce/tough-cookie","keywords":["HTTP","cookie","cookies","set-cookie","cookiejar","jar","RFC6265","RFC2965"],"license":"BSD-3-Clause","main":"./lib/cookie","name":"tough-cookie","repository":{"type":"git","url":"git://github.com/salesforce/tough-cookie.git"},"scripts":{"cover":"nyc --reporter=lcov --reporter=html vows test/*_test.js","test":"vows test/*_test.js"},"version":"2.4.3"}
|
||
|
|
||
|
/***/ })
|
||
|
/******/ ])
|
||
|
});
|
||
|
;
|