mqtt 4.2.5 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mqtt.js +1513 -58
- package/dist/mqtt.min.js +1 -1
- package/lib/connect/index.js +10 -23
- package/package.json +2 -2
package/dist/mqtt.js
CHANGED
|
@@ -1583,7 +1583,7 @@ MqttClient.prototype._onConnect = function (packet) {
|
|
|
1583
1583
|
module.exports = MqttClient
|
|
1584
1584
|
|
|
1585
1585
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
1586
|
-
},{"./store":7,"./validations":8,"_process":44,"debug":14,"events":27,"inherits":29,"mqtt-packet":34,"readable-stream":
|
|
1586
|
+
},{"./store":7,"./validations":8,"_process":44,"debug":14,"events":27,"inherits":29,"mqtt-packet":34,"readable-stream":63,"reinterval":64,"xtend":74}],2:[function(require,module,exports){
|
|
1587
1587
|
(function (Buffer){
|
|
1588
1588
|
'use strict'
|
|
1589
1589
|
|
|
@@ -1715,7 +1715,7 @@ function buildStream (client, opts) {
|
|
|
1715
1715
|
module.exports = buildStream
|
|
1716
1716
|
|
|
1717
1717
|
}).call(this,require("buffer").Buffer)
|
|
1718
|
-
},{"buffer":12,"duplexify":16,"readable-stream":
|
|
1718
|
+
},{"buffer":12,"duplexify":16,"readable-stream":63}],3:[function(require,module,exports){
|
|
1719
1719
|
'use strict'
|
|
1720
1720
|
var net = require('net')
|
|
1721
1721
|
var debug = require('debug')('mqttjs:tcp')
|
|
@@ -2044,7 +2044,7 @@ if (IS_BROWSER) {
|
|
|
2044
2044
|
}
|
|
2045
2045
|
|
|
2046
2046
|
}).call(this,require('_process'),require("buffer").Buffer)
|
|
2047
|
-
},{"_process":44,"buffer":12,"debug":14,"duplexify":16,"readable-stream":
|
|
2047
|
+
},{"_process":44,"buffer":12,"debug":14,"duplexify":16,"readable-stream":63,"ws":73}],6:[function(require,module,exports){
|
|
2048
2048
|
(function (Buffer){
|
|
2049
2049
|
'use strict'
|
|
2050
2050
|
|
|
@@ -2182,7 +2182,7 @@ function buildStream (client, opts) {
|
|
|
2182
2182
|
module.exports = buildStream
|
|
2183
2183
|
|
|
2184
2184
|
}).call(this,require("buffer").Buffer)
|
|
2185
|
-
},{"buffer":12,"duplexify":16,"readable-stream":
|
|
2185
|
+
},{"buffer":12,"duplexify":16,"readable-stream":63}],7:[function(require,module,exports){
|
|
2186
2186
|
'use strict'
|
|
2187
2187
|
|
|
2188
2188
|
/**
|
|
@@ -2312,7 +2312,7 @@ Store.prototype.close = function (cb) {
|
|
|
2312
2312
|
|
|
2313
2313
|
module.exports = Store
|
|
2314
2314
|
|
|
2315
|
-
},{"readable-stream":
|
|
2315
|
+
},{"readable-stream":63,"xtend":74}],8:[function(require,module,exports){
|
|
2316
2316
|
'use strict'
|
|
2317
2317
|
|
|
2318
2318
|
/**
|
|
@@ -2372,6 +2372,8 @@ module.exports = {
|
|
|
2372
2372
|
|
|
2373
2373
|
var MqttClient = require('../client')
|
|
2374
2374
|
var Store = require('../store')
|
|
2375
|
+
var url = require('url')
|
|
2376
|
+
var xtend = require('xtend')
|
|
2375
2377
|
var debug = require('debug')('mqttjs')
|
|
2376
2378
|
|
|
2377
2379
|
var protocols = {}
|
|
@@ -2428,39 +2430,24 @@ function connect (brokerUrl, opts) {
|
|
|
2428
2430
|
opts = opts || {}
|
|
2429
2431
|
|
|
2430
2432
|
if (brokerUrl) {
|
|
2433
|
+
var parsed = url.parse(brokerUrl, true)
|
|
2434
|
+
if (parsed.port != null) {
|
|
2435
|
+
parsed.port = Number(parsed.port)
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
opts = xtend(parsed, opts)
|
|
2439
|
+
|
|
2431
2440
|
if (opts.protocol === null) {
|
|
2432
2441
|
throw new Error('Missing protocol')
|
|
2433
2442
|
}
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
// the URL object is a bit special, so copy individual
|
|
2437
|
-
// items to the opts object
|
|
2438
|
-
opts.hash = parsed.hash
|
|
2439
|
-
opts.host = parsed.host
|
|
2440
|
-
opts.hostname = parsed.hostname
|
|
2441
|
-
opts.href = parsed.href
|
|
2442
|
-
opts.origin = parsed.origin
|
|
2443
|
-
opts.pathname = parsed.pathname
|
|
2444
|
-
opts.port = Number(parsed.port) || null
|
|
2445
|
-
opts.protocol = parsed.protocol
|
|
2446
|
-
opts.username = opts.username || parsed.username || null
|
|
2447
|
-
opts.password = opts.password || parsed.password || null
|
|
2448
|
-
opts.search = parsed.search
|
|
2449
|
-
opts.searchParams = parsed.searchParams
|
|
2450
|
-
opts.path = parsed.pathname + parsed.search
|
|
2443
|
+
|
|
2451
2444
|
opts.protocol = opts.protocol.replace(/:$/, '')
|
|
2452
2445
|
}
|
|
2453
2446
|
|
|
2454
2447
|
// merge in the auth options if supplied
|
|
2455
|
-
// legacy support for url.parse objects (now deprecated in node.js)
|
|
2456
2448
|
parseAuthOptions(opts)
|
|
2457
2449
|
|
|
2458
2450
|
// support clientId passed in the query string of the url
|
|
2459
|
-
if (opts.searchParams && typeof opts.searchParams.get('clientId') === 'string') {
|
|
2460
|
-
opts.clientId = opts.searchParams.get('clientId')
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
// legacy support for url.parse objects (now deprecated in node.js)
|
|
2464
2451
|
if (opts.query && typeof opts.query.clientId === 'string') {
|
|
2465
2452
|
opts.clientId = opts.query.clientId
|
|
2466
2453
|
}
|
|
@@ -2547,7 +2534,7 @@ module.exports.MqttClient = MqttClient
|
|
|
2547
2534
|
module.exports.Store = Store
|
|
2548
2535
|
|
|
2549
2536
|
}).call(this,require('_process'))
|
|
2550
|
-
},{"../client":1,"../store":7,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,"_process":44,"debug":14}],10:[function(require,module,exports){
|
|
2537
|
+
},{"../client":1,"../store":7,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,"_process":44,"debug":14,"url":69,"xtend":74}],10:[function(require,module,exports){
|
|
2551
2538
|
'use strict'
|
|
2552
2539
|
|
|
2553
2540
|
exports.byteLength = byteLength
|
|
@@ -5369,7 +5356,7 @@ Duplexify.prototype.end = function(data, enc, cb) {
|
|
|
5369
5356
|
module.exports = Duplexify
|
|
5370
5357
|
|
|
5371
5358
|
}).call(this,require('_process'),require("buffer").Buffer)
|
|
5372
|
-
},{"_process":44,"buffer":12,"end-of-stream":26,"inherits":29,"readable-stream":25,"stream-shift":
|
|
5359
|
+
},{"_process":44,"buffer":12,"end-of-stream":26,"inherits":29,"readable-stream":25,"stream-shift":66}],17:[function(require,module,exports){
|
|
5373
5360
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
5374
5361
|
//
|
|
5375
5362
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -6571,7 +6558,7 @@ function indexOf(xs, x) {
|
|
|
6571
6558
|
return -1;
|
|
6572
6559
|
}
|
|
6573
6560
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
6574
|
-
},{"./_stream_duplex":17,"./internal/streams/BufferList":22,"./internal/streams/destroy":23,"./internal/streams/stream":24,"_process":44,"core-util-is":13,"events":27,"inherits":29,"isarray":31,"process-nextick-args":43,"safe-buffer":
|
|
6561
|
+
},{"./_stream_duplex":17,"./internal/streams/BufferList":22,"./internal/streams/destroy":23,"./internal/streams/stream":24,"_process":44,"core-util-is":13,"events":27,"inherits":29,"isarray":31,"process-nextick-args":43,"safe-buffer":65,"string_decoder/":67,"util":11}],20:[function(require,module,exports){
|
|
6575
6562
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
6576
6563
|
//
|
|
6577
6564
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -7476,7 +7463,7 @@ Writable.prototype._destroy = function (err, cb) {
|
|
|
7476
7463
|
cb(err);
|
|
7477
7464
|
};
|
|
7478
7465
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
|
|
7479
|
-
},{"./_stream_duplex":17,"./internal/streams/destroy":23,"./internal/streams/stream":24,"_process":44,"core-util-is":13,"inherits":29,"process-nextick-args":43,"safe-buffer":
|
|
7466
|
+
},{"./_stream_duplex":17,"./internal/streams/destroy":23,"./internal/streams/stream":24,"_process":44,"core-util-is":13,"inherits":29,"process-nextick-args":43,"safe-buffer":65,"timers":68,"util-deprecate":71}],22:[function(require,module,exports){
|
|
7480
7467
|
'use strict';
|
|
7481
7468
|
|
|
7482
7469
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -7556,7 +7543,7 @@ if (util && util.inspect && util.inspect.custom) {
|
|
|
7556
7543
|
return this.constructor.name + ' ' + obj;
|
|
7557
7544
|
};
|
|
7558
7545
|
}
|
|
7559
|
-
},{"safe-buffer":
|
|
7546
|
+
},{"safe-buffer":65,"util":11}],23:[function(require,module,exports){
|
|
7560
7547
|
'use strict';
|
|
7561
7548
|
|
|
7562
7549
|
/*<replacement>*/
|
|
@@ -9144,7 +9131,7 @@ module.exports = BufferListStream
|
|
|
9144
9131
|
module.exports.BufferListStream = BufferListStream
|
|
9145
9132
|
module.exports.BufferList = BufferList
|
|
9146
9133
|
|
|
9147
|
-
},{"./BufferList":35,"inherits":29,"readable-stream":
|
|
9134
|
+
},{"./BufferList":35,"inherits":29,"readable-stream":63}],37:[function(require,module,exports){
|
|
9148
9135
|
(function (Buffer){
|
|
9149
9136
|
const max = 65536
|
|
9150
9137
|
const cache = {}
|
|
@@ -11224,7 +11211,7 @@ function onceStrict (fn) {
|
|
|
11224
11211
|
return f
|
|
11225
11212
|
}
|
|
11226
11213
|
|
|
11227
|
-
},{"wrappy":
|
|
11214
|
+
},{"wrappy":72}],43:[function(require,module,exports){
|
|
11228
11215
|
(function (process){
|
|
11229
11216
|
'use strict';
|
|
11230
11217
|
|
|
@@ -11460,6 +11447,722 @@ process.chdir = function (dir) {
|
|
|
11460
11447
|
process.umask = function() { return 0; };
|
|
11461
11448
|
|
|
11462
11449
|
},{}],45:[function(require,module,exports){
|
|
11450
|
+
(function (global){
|
|
11451
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
11452
|
+
;(function(root) {
|
|
11453
|
+
|
|
11454
|
+
/** Detect free variables */
|
|
11455
|
+
var freeExports = typeof exports == 'object' && exports &&
|
|
11456
|
+
!exports.nodeType && exports;
|
|
11457
|
+
var freeModule = typeof module == 'object' && module &&
|
|
11458
|
+
!module.nodeType && module;
|
|
11459
|
+
var freeGlobal = typeof global == 'object' && global;
|
|
11460
|
+
if (
|
|
11461
|
+
freeGlobal.global === freeGlobal ||
|
|
11462
|
+
freeGlobal.window === freeGlobal ||
|
|
11463
|
+
freeGlobal.self === freeGlobal
|
|
11464
|
+
) {
|
|
11465
|
+
root = freeGlobal;
|
|
11466
|
+
}
|
|
11467
|
+
|
|
11468
|
+
/**
|
|
11469
|
+
* The `punycode` object.
|
|
11470
|
+
* @name punycode
|
|
11471
|
+
* @type Object
|
|
11472
|
+
*/
|
|
11473
|
+
var punycode,
|
|
11474
|
+
|
|
11475
|
+
/** Highest positive signed 32-bit float value */
|
|
11476
|
+
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
|
11477
|
+
|
|
11478
|
+
/** Bootstring parameters */
|
|
11479
|
+
base = 36,
|
|
11480
|
+
tMin = 1,
|
|
11481
|
+
tMax = 26,
|
|
11482
|
+
skew = 38,
|
|
11483
|
+
damp = 700,
|
|
11484
|
+
initialBias = 72,
|
|
11485
|
+
initialN = 128, // 0x80
|
|
11486
|
+
delimiter = '-', // '\x2D'
|
|
11487
|
+
|
|
11488
|
+
/** Regular expressions */
|
|
11489
|
+
regexPunycode = /^xn--/,
|
|
11490
|
+
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
|
11491
|
+
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
|
11492
|
+
|
|
11493
|
+
/** Error messages */
|
|
11494
|
+
errors = {
|
|
11495
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
11496
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
11497
|
+
'invalid-input': 'Invalid input'
|
|
11498
|
+
},
|
|
11499
|
+
|
|
11500
|
+
/** Convenience shortcuts */
|
|
11501
|
+
baseMinusTMin = base - tMin,
|
|
11502
|
+
floor = Math.floor,
|
|
11503
|
+
stringFromCharCode = String.fromCharCode,
|
|
11504
|
+
|
|
11505
|
+
/** Temporary variable */
|
|
11506
|
+
key;
|
|
11507
|
+
|
|
11508
|
+
/*--------------------------------------------------------------------------*/
|
|
11509
|
+
|
|
11510
|
+
/**
|
|
11511
|
+
* A generic error utility function.
|
|
11512
|
+
* @private
|
|
11513
|
+
* @param {String} type The error type.
|
|
11514
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
11515
|
+
*/
|
|
11516
|
+
function error(type) {
|
|
11517
|
+
throw new RangeError(errors[type]);
|
|
11518
|
+
}
|
|
11519
|
+
|
|
11520
|
+
/**
|
|
11521
|
+
* A generic `Array#map` utility function.
|
|
11522
|
+
* @private
|
|
11523
|
+
* @param {Array} array The array to iterate over.
|
|
11524
|
+
* @param {Function} callback The function that gets called for every array
|
|
11525
|
+
* item.
|
|
11526
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
11527
|
+
*/
|
|
11528
|
+
function map(array, fn) {
|
|
11529
|
+
var length = array.length;
|
|
11530
|
+
var result = [];
|
|
11531
|
+
while (length--) {
|
|
11532
|
+
result[length] = fn(array[length]);
|
|
11533
|
+
}
|
|
11534
|
+
return result;
|
|
11535
|
+
}
|
|
11536
|
+
|
|
11537
|
+
/**
|
|
11538
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
11539
|
+
* addresses.
|
|
11540
|
+
* @private
|
|
11541
|
+
* @param {String} domain The domain name or email address.
|
|
11542
|
+
* @param {Function} callback The function that gets called for every
|
|
11543
|
+
* character.
|
|
11544
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
11545
|
+
* function.
|
|
11546
|
+
*/
|
|
11547
|
+
function mapDomain(string, fn) {
|
|
11548
|
+
var parts = string.split('@');
|
|
11549
|
+
var result = '';
|
|
11550
|
+
if (parts.length > 1) {
|
|
11551
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
11552
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
11553
|
+
result = parts[0] + '@';
|
|
11554
|
+
string = parts[1];
|
|
11555
|
+
}
|
|
11556
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
11557
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
11558
|
+
var labels = string.split('.');
|
|
11559
|
+
var encoded = map(labels, fn).join('.');
|
|
11560
|
+
return result + encoded;
|
|
11561
|
+
}
|
|
11562
|
+
|
|
11563
|
+
/**
|
|
11564
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
11565
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
11566
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
11567
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
11568
|
+
* matching UTF-16.
|
|
11569
|
+
* @see `punycode.ucs2.encode`
|
|
11570
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
11571
|
+
* @memberOf punycode.ucs2
|
|
11572
|
+
* @name decode
|
|
11573
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
11574
|
+
* @returns {Array} The new array of code points.
|
|
11575
|
+
*/
|
|
11576
|
+
function ucs2decode(string) {
|
|
11577
|
+
var output = [],
|
|
11578
|
+
counter = 0,
|
|
11579
|
+
length = string.length,
|
|
11580
|
+
value,
|
|
11581
|
+
extra;
|
|
11582
|
+
while (counter < length) {
|
|
11583
|
+
value = string.charCodeAt(counter++);
|
|
11584
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
11585
|
+
// high surrogate, and there is a next character
|
|
11586
|
+
extra = string.charCodeAt(counter++);
|
|
11587
|
+
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
|
11588
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
11589
|
+
} else {
|
|
11590
|
+
// unmatched surrogate; only append this code unit, in case the next
|
|
11591
|
+
// code unit is the high surrogate of a surrogate pair
|
|
11592
|
+
output.push(value);
|
|
11593
|
+
counter--;
|
|
11594
|
+
}
|
|
11595
|
+
} else {
|
|
11596
|
+
output.push(value);
|
|
11597
|
+
}
|
|
11598
|
+
}
|
|
11599
|
+
return output;
|
|
11600
|
+
}
|
|
11601
|
+
|
|
11602
|
+
/**
|
|
11603
|
+
* Creates a string based on an array of numeric code points.
|
|
11604
|
+
* @see `punycode.ucs2.decode`
|
|
11605
|
+
* @memberOf punycode.ucs2
|
|
11606
|
+
* @name encode
|
|
11607
|
+
* @param {Array} codePoints The array of numeric code points.
|
|
11608
|
+
* @returns {String} The new Unicode string (UCS-2).
|
|
11609
|
+
*/
|
|
11610
|
+
function ucs2encode(array) {
|
|
11611
|
+
return map(array, function(value) {
|
|
11612
|
+
var output = '';
|
|
11613
|
+
if (value > 0xFFFF) {
|
|
11614
|
+
value -= 0x10000;
|
|
11615
|
+
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
|
11616
|
+
value = 0xDC00 | value & 0x3FF;
|
|
11617
|
+
}
|
|
11618
|
+
output += stringFromCharCode(value);
|
|
11619
|
+
return output;
|
|
11620
|
+
}).join('');
|
|
11621
|
+
}
|
|
11622
|
+
|
|
11623
|
+
/**
|
|
11624
|
+
* Converts a basic code point into a digit/integer.
|
|
11625
|
+
* @see `digitToBasic()`
|
|
11626
|
+
* @private
|
|
11627
|
+
* @param {Number} codePoint The basic numeric code point value.
|
|
11628
|
+
* @returns {Number} The numeric value of a basic code point (for use in
|
|
11629
|
+
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
11630
|
+
* the code point does not represent a value.
|
|
11631
|
+
*/
|
|
11632
|
+
function basicToDigit(codePoint) {
|
|
11633
|
+
if (codePoint - 48 < 10) {
|
|
11634
|
+
return codePoint - 22;
|
|
11635
|
+
}
|
|
11636
|
+
if (codePoint - 65 < 26) {
|
|
11637
|
+
return codePoint - 65;
|
|
11638
|
+
}
|
|
11639
|
+
if (codePoint - 97 < 26) {
|
|
11640
|
+
return codePoint - 97;
|
|
11641
|
+
}
|
|
11642
|
+
return base;
|
|
11643
|
+
}
|
|
11644
|
+
|
|
11645
|
+
/**
|
|
11646
|
+
* Converts a digit/integer into a basic code point.
|
|
11647
|
+
* @see `basicToDigit()`
|
|
11648
|
+
* @private
|
|
11649
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
11650
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
11651
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
11652
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
11653
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
11654
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
11655
|
+
*/
|
|
11656
|
+
function digitToBasic(digit, flag) {
|
|
11657
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
11658
|
+
// 26..35 map to ASCII 0..9
|
|
11659
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
11660
|
+
}
|
|
11661
|
+
|
|
11662
|
+
/**
|
|
11663
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
11664
|
+
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
11665
|
+
* @private
|
|
11666
|
+
*/
|
|
11667
|
+
function adapt(delta, numPoints, firstTime) {
|
|
11668
|
+
var k = 0;
|
|
11669
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
11670
|
+
delta += floor(delta / numPoints);
|
|
11671
|
+
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
11672
|
+
delta = floor(delta / baseMinusTMin);
|
|
11673
|
+
}
|
|
11674
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
11675
|
+
}
|
|
11676
|
+
|
|
11677
|
+
/**
|
|
11678
|
+
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
11679
|
+
* symbols.
|
|
11680
|
+
* @memberOf punycode
|
|
11681
|
+
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
11682
|
+
* @returns {String} The resulting string of Unicode symbols.
|
|
11683
|
+
*/
|
|
11684
|
+
function decode(input) {
|
|
11685
|
+
// Don't use UCS-2
|
|
11686
|
+
var output = [],
|
|
11687
|
+
inputLength = input.length,
|
|
11688
|
+
out,
|
|
11689
|
+
i = 0,
|
|
11690
|
+
n = initialN,
|
|
11691
|
+
bias = initialBias,
|
|
11692
|
+
basic,
|
|
11693
|
+
j,
|
|
11694
|
+
index,
|
|
11695
|
+
oldi,
|
|
11696
|
+
w,
|
|
11697
|
+
k,
|
|
11698
|
+
digit,
|
|
11699
|
+
t,
|
|
11700
|
+
/** Cached calculation results */
|
|
11701
|
+
baseMinusT;
|
|
11702
|
+
|
|
11703
|
+
// Handle the basic code points: let `basic` be the number of input code
|
|
11704
|
+
// points before the last delimiter, or `0` if there is none, then copy
|
|
11705
|
+
// the first basic code points to the output.
|
|
11706
|
+
|
|
11707
|
+
basic = input.lastIndexOf(delimiter);
|
|
11708
|
+
if (basic < 0) {
|
|
11709
|
+
basic = 0;
|
|
11710
|
+
}
|
|
11711
|
+
|
|
11712
|
+
for (j = 0; j < basic; ++j) {
|
|
11713
|
+
// if it's not a basic code point
|
|
11714
|
+
if (input.charCodeAt(j) >= 0x80) {
|
|
11715
|
+
error('not-basic');
|
|
11716
|
+
}
|
|
11717
|
+
output.push(input.charCodeAt(j));
|
|
11718
|
+
}
|
|
11719
|
+
|
|
11720
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
11721
|
+
// points were copied; start at the beginning otherwise.
|
|
11722
|
+
|
|
11723
|
+
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
|
11724
|
+
|
|
11725
|
+
// `index` is the index of the next character to be consumed.
|
|
11726
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
11727
|
+
// which gets added to `i`. The overflow checking is easier
|
|
11728
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
11729
|
+
// value at the end to obtain `delta`.
|
|
11730
|
+
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
|
11731
|
+
|
|
11732
|
+
if (index >= inputLength) {
|
|
11733
|
+
error('invalid-input');
|
|
11734
|
+
}
|
|
11735
|
+
|
|
11736
|
+
digit = basicToDigit(input.charCodeAt(index++));
|
|
11737
|
+
|
|
11738
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
11739
|
+
error('overflow');
|
|
11740
|
+
}
|
|
11741
|
+
|
|
11742
|
+
i += digit * w;
|
|
11743
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
11744
|
+
|
|
11745
|
+
if (digit < t) {
|
|
11746
|
+
break;
|
|
11747
|
+
}
|
|
11748
|
+
|
|
11749
|
+
baseMinusT = base - t;
|
|
11750
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
11751
|
+
error('overflow');
|
|
11752
|
+
}
|
|
11753
|
+
|
|
11754
|
+
w *= baseMinusT;
|
|
11755
|
+
|
|
11756
|
+
}
|
|
11757
|
+
|
|
11758
|
+
out = output.length + 1;
|
|
11759
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
11760
|
+
|
|
11761
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
11762
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
11763
|
+
if (floor(i / out) > maxInt - n) {
|
|
11764
|
+
error('overflow');
|
|
11765
|
+
}
|
|
11766
|
+
|
|
11767
|
+
n += floor(i / out);
|
|
11768
|
+
i %= out;
|
|
11769
|
+
|
|
11770
|
+
// Insert `n` at position `i` of the output
|
|
11771
|
+
output.splice(i++, 0, n);
|
|
11772
|
+
|
|
11773
|
+
}
|
|
11774
|
+
|
|
11775
|
+
return ucs2encode(output);
|
|
11776
|
+
}
|
|
11777
|
+
|
|
11778
|
+
/**
|
|
11779
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
11780
|
+
* Punycode string of ASCII-only symbols.
|
|
11781
|
+
* @memberOf punycode
|
|
11782
|
+
* @param {String} input The string of Unicode symbols.
|
|
11783
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
11784
|
+
*/
|
|
11785
|
+
function encode(input) {
|
|
11786
|
+
var n,
|
|
11787
|
+
delta,
|
|
11788
|
+
handledCPCount,
|
|
11789
|
+
basicLength,
|
|
11790
|
+
bias,
|
|
11791
|
+
j,
|
|
11792
|
+
m,
|
|
11793
|
+
q,
|
|
11794
|
+
k,
|
|
11795
|
+
t,
|
|
11796
|
+
currentValue,
|
|
11797
|
+
output = [],
|
|
11798
|
+
/** `inputLength` will hold the number of code points in `input`. */
|
|
11799
|
+
inputLength,
|
|
11800
|
+
/** Cached calculation results */
|
|
11801
|
+
handledCPCountPlusOne,
|
|
11802
|
+
baseMinusT,
|
|
11803
|
+
qMinusT;
|
|
11804
|
+
|
|
11805
|
+
// Convert the input in UCS-2 to Unicode
|
|
11806
|
+
input = ucs2decode(input);
|
|
11807
|
+
|
|
11808
|
+
// Cache the length
|
|
11809
|
+
inputLength = input.length;
|
|
11810
|
+
|
|
11811
|
+
// Initialize the state
|
|
11812
|
+
n = initialN;
|
|
11813
|
+
delta = 0;
|
|
11814
|
+
bias = initialBias;
|
|
11815
|
+
|
|
11816
|
+
// Handle the basic code points
|
|
11817
|
+
for (j = 0; j < inputLength; ++j) {
|
|
11818
|
+
currentValue = input[j];
|
|
11819
|
+
if (currentValue < 0x80) {
|
|
11820
|
+
output.push(stringFromCharCode(currentValue));
|
|
11821
|
+
}
|
|
11822
|
+
}
|
|
11823
|
+
|
|
11824
|
+
handledCPCount = basicLength = output.length;
|
|
11825
|
+
|
|
11826
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
11827
|
+
// `basicLength` is the number of basic code points.
|
|
11828
|
+
|
|
11829
|
+
// Finish the basic string - if it is not empty - with a delimiter
|
|
11830
|
+
if (basicLength) {
|
|
11831
|
+
output.push(delimiter);
|
|
11832
|
+
}
|
|
11833
|
+
|
|
11834
|
+
// Main encoding loop:
|
|
11835
|
+
while (handledCPCount < inputLength) {
|
|
11836
|
+
|
|
11837
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
11838
|
+
// larger one:
|
|
11839
|
+
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
|
11840
|
+
currentValue = input[j];
|
|
11841
|
+
if (currentValue >= n && currentValue < m) {
|
|
11842
|
+
m = currentValue;
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11845
|
+
|
|
11846
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
11847
|
+
// but guard against overflow
|
|
11848
|
+
handledCPCountPlusOne = handledCPCount + 1;
|
|
11849
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
11850
|
+
error('overflow');
|
|
11851
|
+
}
|
|
11852
|
+
|
|
11853
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
11854
|
+
n = m;
|
|
11855
|
+
|
|
11856
|
+
for (j = 0; j < inputLength; ++j) {
|
|
11857
|
+
currentValue = input[j];
|
|
11858
|
+
|
|
11859
|
+
if (currentValue < n && ++delta > maxInt) {
|
|
11860
|
+
error('overflow');
|
|
11861
|
+
}
|
|
11862
|
+
|
|
11863
|
+
if (currentValue == n) {
|
|
11864
|
+
// Represent delta as a generalized variable-length integer
|
|
11865
|
+
for (q = delta, k = base; /* no condition */; k += base) {
|
|
11866
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
11867
|
+
if (q < t) {
|
|
11868
|
+
break;
|
|
11869
|
+
}
|
|
11870
|
+
qMinusT = q - t;
|
|
11871
|
+
baseMinusT = base - t;
|
|
11872
|
+
output.push(
|
|
11873
|
+
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
11874
|
+
);
|
|
11875
|
+
q = floor(qMinusT / baseMinusT);
|
|
11876
|
+
}
|
|
11877
|
+
|
|
11878
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
11879
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
11880
|
+
delta = 0;
|
|
11881
|
+
++handledCPCount;
|
|
11882
|
+
}
|
|
11883
|
+
}
|
|
11884
|
+
|
|
11885
|
+
++delta;
|
|
11886
|
+
++n;
|
|
11887
|
+
|
|
11888
|
+
}
|
|
11889
|
+
return output.join('');
|
|
11890
|
+
}
|
|
11891
|
+
|
|
11892
|
+
/**
|
|
11893
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
11894
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
11895
|
+
* it doesn't matter if you call it on a string that has already been
|
|
11896
|
+
* converted to Unicode.
|
|
11897
|
+
* @memberOf punycode
|
|
11898
|
+
* @param {String} input The Punycoded domain name or email address to
|
|
11899
|
+
* convert to Unicode.
|
|
11900
|
+
* @returns {String} The Unicode representation of the given Punycode
|
|
11901
|
+
* string.
|
|
11902
|
+
*/
|
|
11903
|
+
function toUnicode(input) {
|
|
11904
|
+
return mapDomain(input, function(string) {
|
|
11905
|
+
return regexPunycode.test(string)
|
|
11906
|
+
? decode(string.slice(4).toLowerCase())
|
|
11907
|
+
: string;
|
|
11908
|
+
});
|
|
11909
|
+
}
|
|
11910
|
+
|
|
11911
|
+
/**
|
|
11912
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
11913
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
11914
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
11915
|
+
* ASCII.
|
|
11916
|
+
* @memberOf punycode
|
|
11917
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
11918
|
+
* Unicode string.
|
|
11919
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
11920
|
+
* email address.
|
|
11921
|
+
*/
|
|
11922
|
+
function toASCII(input) {
|
|
11923
|
+
return mapDomain(input, function(string) {
|
|
11924
|
+
return regexNonASCII.test(string)
|
|
11925
|
+
? 'xn--' + encode(string)
|
|
11926
|
+
: string;
|
|
11927
|
+
});
|
|
11928
|
+
}
|
|
11929
|
+
|
|
11930
|
+
/*--------------------------------------------------------------------------*/
|
|
11931
|
+
|
|
11932
|
+
/** Define the public API */
|
|
11933
|
+
punycode = {
|
|
11934
|
+
/**
|
|
11935
|
+
* A string representing the current Punycode.js version number.
|
|
11936
|
+
* @memberOf punycode
|
|
11937
|
+
* @type String
|
|
11938
|
+
*/
|
|
11939
|
+
'version': '1.4.1',
|
|
11940
|
+
/**
|
|
11941
|
+
* An object of methods to convert from JavaScript's internal character
|
|
11942
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
11943
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
11944
|
+
* @memberOf punycode
|
|
11945
|
+
* @type Object
|
|
11946
|
+
*/
|
|
11947
|
+
'ucs2': {
|
|
11948
|
+
'decode': ucs2decode,
|
|
11949
|
+
'encode': ucs2encode
|
|
11950
|
+
},
|
|
11951
|
+
'decode': decode,
|
|
11952
|
+
'encode': encode,
|
|
11953
|
+
'toASCII': toASCII,
|
|
11954
|
+
'toUnicode': toUnicode
|
|
11955
|
+
};
|
|
11956
|
+
|
|
11957
|
+
/** Expose `punycode` */
|
|
11958
|
+
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
11959
|
+
// like the following:
|
|
11960
|
+
if (
|
|
11961
|
+
typeof define == 'function' &&
|
|
11962
|
+
typeof define.amd == 'object' &&
|
|
11963
|
+
define.amd
|
|
11964
|
+
) {
|
|
11965
|
+
define('punycode', function() {
|
|
11966
|
+
return punycode;
|
|
11967
|
+
});
|
|
11968
|
+
} else if (freeExports && freeModule) {
|
|
11969
|
+
if (module.exports == freeExports) {
|
|
11970
|
+
// in Node.js, io.js, or RingoJS v0.8.0+
|
|
11971
|
+
freeModule.exports = punycode;
|
|
11972
|
+
} else {
|
|
11973
|
+
// in Narwhal or RingoJS v0.7.0-
|
|
11974
|
+
for (key in punycode) {
|
|
11975
|
+
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
|
11976
|
+
}
|
|
11977
|
+
}
|
|
11978
|
+
} else {
|
|
11979
|
+
// in Rhino or a web browser
|
|
11980
|
+
root.punycode = punycode;
|
|
11981
|
+
}
|
|
11982
|
+
|
|
11983
|
+
}(this));
|
|
11984
|
+
|
|
11985
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
11986
|
+
},{}],46:[function(require,module,exports){
|
|
11987
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
11988
|
+
//
|
|
11989
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
11990
|
+
// copy of this software and associated documentation files (the
|
|
11991
|
+
// "Software"), to deal in the Software without restriction, including
|
|
11992
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11993
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
11994
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
11995
|
+
// following conditions:
|
|
11996
|
+
//
|
|
11997
|
+
// The above copyright notice and this permission notice shall be included
|
|
11998
|
+
// in all copies or substantial portions of the Software.
|
|
11999
|
+
//
|
|
12000
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
12001
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
12002
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
12003
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
12004
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
12005
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
12006
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
12007
|
+
|
|
12008
|
+
'use strict';
|
|
12009
|
+
|
|
12010
|
+
// If obj.hasOwnProperty has been overridden, then calling
|
|
12011
|
+
// obj.hasOwnProperty(prop) will break.
|
|
12012
|
+
// See: https://github.com/joyent/node/issues/1707
|
|
12013
|
+
function hasOwnProperty(obj, prop) {
|
|
12014
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
12015
|
+
}
|
|
12016
|
+
|
|
12017
|
+
module.exports = function(qs, sep, eq, options) {
|
|
12018
|
+
sep = sep || '&';
|
|
12019
|
+
eq = eq || '=';
|
|
12020
|
+
var obj = {};
|
|
12021
|
+
|
|
12022
|
+
if (typeof qs !== 'string' || qs.length === 0) {
|
|
12023
|
+
return obj;
|
|
12024
|
+
}
|
|
12025
|
+
|
|
12026
|
+
var regexp = /\+/g;
|
|
12027
|
+
qs = qs.split(sep);
|
|
12028
|
+
|
|
12029
|
+
var maxKeys = 1000;
|
|
12030
|
+
if (options && typeof options.maxKeys === 'number') {
|
|
12031
|
+
maxKeys = options.maxKeys;
|
|
12032
|
+
}
|
|
12033
|
+
|
|
12034
|
+
var len = qs.length;
|
|
12035
|
+
// maxKeys <= 0 means that we should not limit keys count
|
|
12036
|
+
if (maxKeys > 0 && len > maxKeys) {
|
|
12037
|
+
len = maxKeys;
|
|
12038
|
+
}
|
|
12039
|
+
|
|
12040
|
+
for (var i = 0; i < len; ++i) {
|
|
12041
|
+
var x = qs[i].replace(regexp, '%20'),
|
|
12042
|
+
idx = x.indexOf(eq),
|
|
12043
|
+
kstr, vstr, k, v;
|
|
12044
|
+
|
|
12045
|
+
if (idx >= 0) {
|
|
12046
|
+
kstr = x.substr(0, idx);
|
|
12047
|
+
vstr = x.substr(idx + 1);
|
|
12048
|
+
} else {
|
|
12049
|
+
kstr = x;
|
|
12050
|
+
vstr = '';
|
|
12051
|
+
}
|
|
12052
|
+
|
|
12053
|
+
k = decodeURIComponent(kstr);
|
|
12054
|
+
v = decodeURIComponent(vstr);
|
|
12055
|
+
|
|
12056
|
+
if (!hasOwnProperty(obj, k)) {
|
|
12057
|
+
obj[k] = v;
|
|
12058
|
+
} else if (isArray(obj[k])) {
|
|
12059
|
+
obj[k].push(v);
|
|
12060
|
+
} else {
|
|
12061
|
+
obj[k] = [obj[k], v];
|
|
12062
|
+
}
|
|
12063
|
+
}
|
|
12064
|
+
|
|
12065
|
+
return obj;
|
|
12066
|
+
};
|
|
12067
|
+
|
|
12068
|
+
var isArray = Array.isArray || function (xs) {
|
|
12069
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
12070
|
+
};
|
|
12071
|
+
|
|
12072
|
+
},{}],47:[function(require,module,exports){
|
|
12073
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
12074
|
+
//
|
|
12075
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
12076
|
+
// copy of this software and associated documentation files (the
|
|
12077
|
+
// "Software"), to deal in the Software without restriction, including
|
|
12078
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
12079
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
12080
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
12081
|
+
// following conditions:
|
|
12082
|
+
//
|
|
12083
|
+
// The above copyright notice and this permission notice shall be included
|
|
12084
|
+
// in all copies or substantial portions of the Software.
|
|
12085
|
+
//
|
|
12086
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
12087
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
12088
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
12089
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
12090
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
12091
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
12092
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
12093
|
+
|
|
12094
|
+
'use strict';
|
|
12095
|
+
|
|
12096
|
+
var stringifyPrimitive = function(v) {
|
|
12097
|
+
switch (typeof v) {
|
|
12098
|
+
case 'string':
|
|
12099
|
+
return v;
|
|
12100
|
+
|
|
12101
|
+
case 'boolean':
|
|
12102
|
+
return v ? 'true' : 'false';
|
|
12103
|
+
|
|
12104
|
+
case 'number':
|
|
12105
|
+
return isFinite(v) ? v : '';
|
|
12106
|
+
|
|
12107
|
+
default:
|
|
12108
|
+
return '';
|
|
12109
|
+
}
|
|
12110
|
+
};
|
|
12111
|
+
|
|
12112
|
+
module.exports = function(obj, sep, eq, name) {
|
|
12113
|
+
sep = sep || '&';
|
|
12114
|
+
eq = eq || '=';
|
|
12115
|
+
if (obj === null) {
|
|
12116
|
+
obj = undefined;
|
|
12117
|
+
}
|
|
12118
|
+
|
|
12119
|
+
if (typeof obj === 'object') {
|
|
12120
|
+
return map(objectKeys(obj), function(k) {
|
|
12121
|
+
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
|
12122
|
+
if (isArray(obj[k])) {
|
|
12123
|
+
return map(obj[k], function(v) {
|
|
12124
|
+
return ks + encodeURIComponent(stringifyPrimitive(v));
|
|
12125
|
+
}).join(sep);
|
|
12126
|
+
} else {
|
|
12127
|
+
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
|
12128
|
+
}
|
|
12129
|
+
}).join(sep);
|
|
12130
|
+
|
|
12131
|
+
}
|
|
12132
|
+
|
|
12133
|
+
if (!name) return '';
|
|
12134
|
+
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
|
12135
|
+
encodeURIComponent(stringifyPrimitive(obj));
|
|
12136
|
+
};
|
|
12137
|
+
|
|
12138
|
+
var isArray = Array.isArray || function (xs) {
|
|
12139
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
12140
|
+
};
|
|
12141
|
+
|
|
12142
|
+
function map (xs, f) {
|
|
12143
|
+
if (xs.map) return xs.map(f);
|
|
12144
|
+
var res = [];
|
|
12145
|
+
for (var i = 0; i < xs.length; i++) {
|
|
12146
|
+
res.push(f(xs[i], i));
|
|
12147
|
+
}
|
|
12148
|
+
return res;
|
|
12149
|
+
}
|
|
12150
|
+
|
|
12151
|
+
var objectKeys = Object.keys || function (obj) {
|
|
12152
|
+
var res = [];
|
|
12153
|
+
for (var key in obj) {
|
|
12154
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
|
12155
|
+
}
|
|
12156
|
+
return res;
|
|
12157
|
+
};
|
|
12158
|
+
|
|
12159
|
+
},{}],48:[function(require,module,exports){
|
|
12160
|
+
'use strict';
|
|
12161
|
+
|
|
12162
|
+
exports.decode = exports.parse = require('./decode');
|
|
12163
|
+
exports.encode = exports.stringify = require('./encode');
|
|
12164
|
+
|
|
12165
|
+
},{"./decode":46,"./encode":47}],49:[function(require,module,exports){
|
|
11463
12166
|
'use strict';
|
|
11464
12167
|
|
|
11465
12168
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
@@ -11588,7 +12291,7 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
|
11588
12291
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
|
11589
12292
|
module.exports.codes = codes;
|
|
11590
12293
|
|
|
11591
|
-
},{}],
|
|
12294
|
+
},{}],50:[function(require,module,exports){
|
|
11592
12295
|
(function (process){
|
|
11593
12296
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
11594
12297
|
//
|
|
@@ -11730,7 +12433,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
|
|
|
11730
12433
|
}
|
|
11731
12434
|
});
|
|
11732
12435
|
}).call(this,require('_process'))
|
|
11733
|
-
},{"./_stream_readable":
|
|
12436
|
+
},{"./_stream_readable":52,"./_stream_writable":54,"_process":44,"inherits":29}],51:[function(require,module,exports){
|
|
11734
12437
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
11735
12438
|
//
|
|
11736
12439
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -11770,7 +12473,7 @@ function PassThrough(options) {
|
|
|
11770
12473
|
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
|
11771
12474
|
cb(null, chunk);
|
|
11772
12475
|
};
|
|
11773
|
-
},{"./_stream_transform":
|
|
12476
|
+
},{"./_stream_transform":53,"inherits":29}],52:[function(require,module,exports){
|
|
11774
12477
|
(function (process,global){
|
|
11775
12478
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
11776
12479
|
//
|
|
@@ -12897,7 +13600,7 @@ function indexOf(xs, x) {
|
|
|
12897
13600
|
return -1;
|
|
12898
13601
|
}
|
|
12899
13602
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
12900
|
-
},{"../errors":
|
|
13603
|
+
},{"../errors":49,"./_stream_duplex":50,"./internal/streams/async_iterator":55,"./internal/streams/buffer_list":56,"./internal/streams/destroy":57,"./internal/streams/from":59,"./internal/streams/state":61,"./internal/streams/stream":62,"_process":44,"buffer":12,"events":27,"inherits":29,"string_decoder/":67,"util":11}],53:[function(require,module,exports){
|
|
12901
13604
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
12902
13605
|
//
|
|
12903
13606
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -13099,7 +13802,7 @@ function done(stream, er, data) {
|
|
|
13099
13802
|
if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
|
13100
13803
|
return stream.push(null);
|
|
13101
13804
|
}
|
|
13102
|
-
},{"../errors":
|
|
13805
|
+
},{"../errors":49,"./_stream_duplex":50,"inherits":29}],54:[function(require,module,exports){
|
|
13103
13806
|
(function (process,global){
|
|
13104
13807
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13105
13808
|
//
|
|
@@ -13799,7 +14502,7 @@ Writable.prototype._destroy = function (err, cb) {
|
|
|
13799
14502
|
cb(err);
|
|
13800
14503
|
};
|
|
13801
14504
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
13802
|
-
},{"../errors":
|
|
14505
|
+
},{"../errors":49,"./_stream_duplex":50,"./internal/streams/destroy":57,"./internal/streams/state":61,"./internal/streams/stream":62,"_process":44,"buffer":12,"inherits":29,"util-deprecate":71}],55:[function(require,module,exports){
|
|
13803
14506
|
(function (process){
|
|
13804
14507
|
'use strict';
|
|
13805
14508
|
|
|
@@ -14009,7 +14712,7 @@ var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterat
|
|
|
14009
14712
|
|
|
14010
14713
|
module.exports = createReadableStreamAsyncIterator;
|
|
14011
14714
|
}).call(this,require('_process'))
|
|
14012
|
-
},{"./end-of-stream":
|
|
14715
|
+
},{"./end-of-stream":58,"_process":44}],56:[function(require,module,exports){
|
|
14013
14716
|
'use strict';
|
|
14014
14717
|
|
|
14015
14718
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -14220,7 +14923,7 @@ function () {
|
|
|
14220
14923
|
|
|
14221
14924
|
return BufferList;
|
|
14222
14925
|
}();
|
|
14223
|
-
},{"buffer":12,"util":11}],
|
|
14926
|
+
},{"buffer":12,"util":11}],57:[function(require,module,exports){
|
|
14224
14927
|
(function (process){
|
|
14225
14928
|
'use strict'; // undocumented cb() API, needed for core, not for public API
|
|
14226
14929
|
|
|
@@ -14328,7 +15031,7 @@ module.exports = {
|
|
|
14328
15031
|
errorOrDestroy: errorOrDestroy
|
|
14329
15032
|
};
|
|
14330
15033
|
}).call(this,require('_process'))
|
|
14331
|
-
},{"_process":44}],
|
|
15034
|
+
},{"_process":44}],58:[function(require,module,exports){
|
|
14332
15035
|
// Ported from https://github.com/mafintosh/end-of-stream with
|
|
14333
15036
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
14334
15037
|
'use strict';
|
|
@@ -14433,12 +15136,12 @@ function eos(stream, opts, callback) {
|
|
|
14433
15136
|
}
|
|
14434
15137
|
|
|
14435
15138
|
module.exports = eos;
|
|
14436
|
-
},{"../../../errors":
|
|
15139
|
+
},{"../../../errors":49}],59:[function(require,module,exports){
|
|
14437
15140
|
module.exports = function () {
|
|
14438
15141
|
throw new Error('Readable.from is not available in the browser')
|
|
14439
15142
|
};
|
|
14440
15143
|
|
|
14441
|
-
},{}],
|
|
15144
|
+
},{}],60:[function(require,module,exports){
|
|
14442
15145
|
// Ported from https://github.com/mafintosh/pump with
|
|
14443
15146
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
14444
15147
|
'use strict';
|
|
@@ -14536,7 +15239,7 @@ function pipeline() {
|
|
|
14536
15239
|
}
|
|
14537
15240
|
|
|
14538
15241
|
module.exports = pipeline;
|
|
14539
|
-
},{"../../../errors":
|
|
15242
|
+
},{"../../../errors":49,"./end-of-stream":58}],61:[function(require,module,exports){
|
|
14540
15243
|
'use strict';
|
|
14541
15244
|
|
|
14542
15245
|
var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
|
|
@@ -14564,9 +15267,9 @@ function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
|
|
14564
15267
|
module.exports = {
|
|
14565
15268
|
getHighWaterMark: getHighWaterMark
|
|
14566
15269
|
};
|
|
14567
|
-
},{"../../../errors":
|
|
15270
|
+
},{"../../../errors":49}],62:[function(require,module,exports){
|
|
14568
15271
|
arguments[4][24][0].apply(exports,arguments)
|
|
14569
|
-
},{"dup":24,"events":27}],
|
|
15272
|
+
},{"dup":24,"events":27}],63:[function(require,module,exports){
|
|
14570
15273
|
exports = module.exports = require('./lib/_stream_readable.js');
|
|
14571
15274
|
exports.Stream = exports;
|
|
14572
15275
|
exports.Readable = exports;
|
|
@@ -14577,7 +15280,7 @@ exports.PassThrough = require('./lib/_stream_passthrough.js');
|
|
|
14577
15280
|
exports.finished = require('./lib/internal/streams/end-of-stream.js');
|
|
14578
15281
|
exports.pipeline = require('./lib/internal/streams/pipeline.js');
|
|
14579
15282
|
|
|
14580
|
-
},{"./lib/_stream_duplex.js":
|
|
15283
|
+
},{"./lib/_stream_duplex.js":50,"./lib/_stream_passthrough.js":51,"./lib/_stream_readable.js":52,"./lib/_stream_transform.js":53,"./lib/_stream_writable.js":54,"./lib/internal/streams/end-of-stream.js":58,"./lib/internal/streams/pipeline.js":60}],64:[function(require,module,exports){
|
|
14581
15284
|
'use strict'
|
|
14582
15285
|
|
|
14583
15286
|
function ReInterval (callback, interval, args) {
|
|
@@ -14636,7 +15339,7 @@ function reInterval () {
|
|
|
14636
15339
|
|
|
14637
15340
|
module.exports = reInterval;
|
|
14638
15341
|
|
|
14639
|
-
},{}],
|
|
15342
|
+
},{}],65:[function(require,module,exports){
|
|
14640
15343
|
/* eslint-disable node/no-deprecated-api */
|
|
14641
15344
|
var buffer = require('buffer')
|
|
14642
15345
|
var Buffer = buffer.Buffer
|
|
@@ -14700,7 +15403,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
|
|
|
14700
15403
|
return buffer.SlowBuffer(size)
|
|
14701
15404
|
}
|
|
14702
15405
|
|
|
14703
|
-
},{"buffer":12}],
|
|
15406
|
+
},{"buffer":12}],66:[function(require,module,exports){
|
|
14704
15407
|
module.exports = shift
|
|
14705
15408
|
|
|
14706
15409
|
function shift (stream) {
|
|
@@ -14722,7 +15425,7 @@ function getStateLength (state) {
|
|
|
14722
15425
|
return state.length
|
|
14723
15426
|
}
|
|
14724
15427
|
|
|
14725
|
-
},{}],
|
|
15428
|
+
},{}],67:[function(require,module,exports){
|
|
14726
15429
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
14727
15430
|
//
|
|
14728
15431
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -15019,7 +15722,7 @@ function simpleWrite(buf) {
|
|
|
15019
15722
|
function simpleEnd(buf) {
|
|
15020
15723
|
return buf && buf.length ? this.write(buf) : '';
|
|
15021
15724
|
}
|
|
15022
|
-
},{"safe-buffer":
|
|
15725
|
+
},{"safe-buffer":65}],68:[function(require,module,exports){
|
|
15023
15726
|
(function (setImmediate,clearImmediate){
|
|
15024
15727
|
var nextTick = require('process/browser.js').nextTick;
|
|
15025
15728
|
var apply = Function.prototype.apply;
|
|
@@ -15098,7 +15801,759 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate :
|
|
|
15098
15801
|
delete immediateIds[id];
|
|
15099
15802
|
};
|
|
15100
15803
|
}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
|
15101
|
-
},{"process/browser.js":44,"timers":
|
|
15804
|
+
},{"process/browser.js":44,"timers":68}],69:[function(require,module,exports){
|
|
15805
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
15806
|
+
//
|
|
15807
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
15808
|
+
// copy of this software and associated documentation files (the
|
|
15809
|
+
// "Software"), to deal in the Software without restriction, including
|
|
15810
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
15811
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
15812
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
15813
|
+
// following conditions:
|
|
15814
|
+
//
|
|
15815
|
+
// The above copyright notice and this permission notice shall be included
|
|
15816
|
+
// in all copies or substantial portions of the Software.
|
|
15817
|
+
//
|
|
15818
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15819
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
15820
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
15821
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
15822
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
15823
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
15824
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15825
|
+
|
|
15826
|
+
'use strict';
|
|
15827
|
+
|
|
15828
|
+
var punycode = require('punycode');
|
|
15829
|
+
var util = require('./util');
|
|
15830
|
+
|
|
15831
|
+
exports.parse = urlParse;
|
|
15832
|
+
exports.resolve = urlResolve;
|
|
15833
|
+
exports.resolveObject = urlResolveObject;
|
|
15834
|
+
exports.format = urlFormat;
|
|
15835
|
+
|
|
15836
|
+
exports.Url = Url;
|
|
15837
|
+
|
|
15838
|
+
function Url() {
|
|
15839
|
+
this.protocol = null;
|
|
15840
|
+
this.slashes = null;
|
|
15841
|
+
this.auth = null;
|
|
15842
|
+
this.host = null;
|
|
15843
|
+
this.port = null;
|
|
15844
|
+
this.hostname = null;
|
|
15845
|
+
this.hash = null;
|
|
15846
|
+
this.search = null;
|
|
15847
|
+
this.query = null;
|
|
15848
|
+
this.pathname = null;
|
|
15849
|
+
this.path = null;
|
|
15850
|
+
this.href = null;
|
|
15851
|
+
}
|
|
15852
|
+
|
|
15853
|
+
// Reference: RFC 3986, RFC 1808, RFC 2396
|
|
15854
|
+
|
|
15855
|
+
// define these here so at least they only have to be
|
|
15856
|
+
// compiled once on the first module load.
|
|
15857
|
+
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
|
15858
|
+
portPattern = /:[0-9]*$/,
|
|
15859
|
+
|
|
15860
|
+
// Special case for a simple path URL
|
|
15861
|
+
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
|
15862
|
+
|
|
15863
|
+
// RFC 2396: characters reserved for delimiting URLs.
|
|
15864
|
+
// We actually just auto-escape these.
|
|
15865
|
+
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
|
15866
|
+
|
|
15867
|
+
// RFC 2396: characters not allowed for various reasons.
|
|
15868
|
+
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
|
15869
|
+
|
|
15870
|
+
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
|
15871
|
+
autoEscape = ['\''].concat(unwise),
|
|
15872
|
+
// Characters that are never ever allowed in a hostname.
|
|
15873
|
+
// Note that any invalid chars are also handled, but these
|
|
15874
|
+
// are the ones that are *expected* to be seen, so we fast-path
|
|
15875
|
+
// them.
|
|
15876
|
+
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
|
15877
|
+
hostEndingChars = ['/', '?', '#'],
|
|
15878
|
+
hostnameMaxLen = 255,
|
|
15879
|
+
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
|
15880
|
+
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
|
15881
|
+
// protocols that can allow "unsafe" and "unwise" chars.
|
|
15882
|
+
unsafeProtocol = {
|
|
15883
|
+
'javascript': true,
|
|
15884
|
+
'javascript:': true
|
|
15885
|
+
},
|
|
15886
|
+
// protocols that never have a hostname.
|
|
15887
|
+
hostlessProtocol = {
|
|
15888
|
+
'javascript': true,
|
|
15889
|
+
'javascript:': true
|
|
15890
|
+
},
|
|
15891
|
+
// protocols that always contain a // bit.
|
|
15892
|
+
slashedProtocol = {
|
|
15893
|
+
'http': true,
|
|
15894
|
+
'https': true,
|
|
15895
|
+
'ftp': true,
|
|
15896
|
+
'gopher': true,
|
|
15897
|
+
'file': true,
|
|
15898
|
+
'http:': true,
|
|
15899
|
+
'https:': true,
|
|
15900
|
+
'ftp:': true,
|
|
15901
|
+
'gopher:': true,
|
|
15902
|
+
'file:': true
|
|
15903
|
+
},
|
|
15904
|
+
querystring = require('querystring');
|
|
15905
|
+
|
|
15906
|
+
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|
15907
|
+
if (url && util.isObject(url) && url instanceof Url) return url;
|
|
15908
|
+
|
|
15909
|
+
var u = new Url;
|
|
15910
|
+
u.parse(url, parseQueryString, slashesDenoteHost);
|
|
15911
|
+
return u;
|
|
15912
|
+
}
|
|
15913
|
+
|
|
15914
|
+
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
|
15915
|
+
if (!util.isString(url)) {
|
|
15916
|
+
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
|
15917
|
+
}
|
|
15918
|
+
|
|
15919
|
+
// Copy chrome, IE, opera backslash-handling behavior.
|
|
15920
|
+
// Back slashes before the query string get converted to forward slashes
|
|
15921
|
+
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
|
15922
|
+
var queryIndex = url.indexOf('?'),
|
|
15923
|
+
splitter =
|
|
15924
|
+
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
|
15925
|
+
uSplit = url.split(splitter),
|
|
15926
|
+
slashRegex = /\\/g;
|
|
15927
|
+
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
|
15928
|
+
url = uSplit.join(splitter);
|
|
15929
|
+
|
|
15930
|
+
var rest = url;
|
|
15931
|
+
|
|
15932
|
+
// trim before proceeding.
|
|
15933
|
+
// This is to support parse stuff like " http://foo.com \n"
|
|
15934
|
+
rest = rest.trim();
|
|
15935
|
+
|
|
15936
|
+
if (!slashesDenoteHost && url.split('#').length === 1) {
|
|
15937
|
+
// Try fast path regexp
|
|
15938
|
+
var simplePath = simplePathPattern.exec(rest);
|
|
15939
|
+
if (simplePath) {
|
|
15940
|
+
this.path = rest;
|
|
15941
|
+
this.href = rest;
|
|
15942
|
+
this.pathname = simplePath[1];
|
|
15943
|
+
if (simplePath[2]) {
|
|
15944
|
+
this.search = simplePath[2];
|
|
15945
|
+
if (parseQueryString) {
|
|
15946
|
+
this.query = querystring.parse(this.search.substr(1));
|
|
15947
|
+
} else {
|
|
15948
|
+
this.query = this.search.substr(1);
|
|
15949
|
+
}
|
|
15950
|
+
} else if (parseQueryString) {
|
|
15951
|
+
this.search = '';
|
|
15952
|
+
this.query = {};
|
|
15953
|
+
}
|
|
15954
|
+
return this;
|
|
15955
|
+
}
|
|
15956
|
+
}
|
|
15957
|
+
|
|
15958
|
+
var proto = protocolPattern.exec(rest);
|
|
15959
|
+
if (proto) {
|
|
15960
|
+
proto = proto[0];
|
|
15961
|
+
var lowerProto = proto.toLowerCase();
|
|
15962
|
+
this.protocol = lowerProto;
|
|
15963
|
+
rest = rest.substr(proto.length);
|
|
15964
|
+
}
|
|
15965
|
+
|
|
15966
|
+
// figure out if it's got a host
|
|
15967
|
+
// user@server is *always* interpreted as a hostname, and url
|
|
15968
|
+
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
|
15969
|
+
// how the browser resolves relative URLs.
|
|
15970
|
+
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
|
15971
|
+
var slashes = rest.substr(0, 2) === '//';
|
|
15972
|
+
if (slashes && !(proto && hostlessProtocol[proto])) {
|
|
15973
|
+
rest = rest.substr(2);
|
|
15974
|
+
this.slashes = true;
|
|
15975
|
+
}
|
|
15976
|
+
}
|
|
15977
|
+
|
|
15978
|
+
if (!hostlessProtocol[proto] &&
|
|
15979
|
+
(slashes || (proto && !slashedProtocol[proto]))) {
|
|
15980
|
+
|
|
15981
|
+
// there's a hostname.
|
|
15982
|
+
// the first instance of /, ?, ;, or # ends the host.
|
|
15983
|
+
//
|
|
15984
|
+
// If there is an @ in the hostname, then non-host chars *are* allowed
|
|
15985
|
+
// to the left of the last @ sign, unless some host-ending character
|
|
15986
|
+
// comes *before* the @-sign.
|
|
15987
|
+
// URLs are obnoxious.
|
|
15988
|
+
//
|
|
15989
|
+
// ex:
|
|
15990
|
+
// http://a@b@c/ => user:a@b host:c
|
|
15991
|
+
// http://a@b?@c => user:a host:c path:/?@c
|
|
15992
|
+
|
|
15993
|
+
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
|
15994
|
+
// Review our test case against browsers more comprehensively.
|
|
15995
|
+
|
|
15996
|
+
// find the first instance of any hostEndingChars
|
|
15997
|
+
var hostEnd = -1;
|
|
15998
|
+
for (var i = 0; i < hostEndingChars.length; i++) {
|
|
15999
|
+
var hec = rest.indexOf(hostEndingChars[i]);
|
|
16000
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
16001
|
+
hostEnd = hec;
|
|
16002
|
+
}
|
|
16003
|
+
|
|
16004
|
+
// at this point, either we have an explicit point where the
|
|
16005
|
+
// auth portion cannot go past, or the last @ char is the decider.
|
|
16006
|
+
var auth, atSign;
|
|
16007
|
+
if (hostEnd === -1) {
|
|
16008
|
+
// atSign can be anywhere.
|
|
16009
|
+
atSign = rest.lastIndexOf('@');
|
|
16010
|
+
} else {
|
|
16011
|
+
// atSign must be in auth portion.
|
|
16012
|
+
// http://a@b/c@d => host:b auth:a path:/c@d
|
|
16013
|
+
atSign = rest.lastIndexOf('@', hostEnd);
|
|
16014
|
+
}
|
|
16015
|
+
|
|
16016
|
+
// Now we have a portion which is definitely the auth.
|
|
16017
|
+
// Pull that off.
|
|
16018
|
+
if (atSign !== -1) {
|
|
16019
|
+
auth = rest.slice(0, atSign);
|
|
16020
|
+
rest = rest.slice(atSign + 1);
|
|
16021
|
+
this.auth = decodeURIComponent(auth);
|
|
16022
|
+
}
|
|
16023
|
+
|
|
16024
|
+
// the host is the remaining to the left of the first non-host char
|
|
16025
|
+
hostEnd = -1;
|
|
16026
|
+
for (var i = 0; i < nonHostChars.length; i++) {
|
|
16027
|
+
var hec = rest.indexOf(nonHostChars[i]);
|
|
16028
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
16029
|
+
hostEnd = hec;
|
|
16030
|
+
}
|
|
16031
|
+
// if we still have not hit it, then the entire thing is a host.
|
|
16032
|
+
if (hostEnd === -1)
|
|
16033
|
+
hostEnd = rest.length;
|
|
16034
|
+
|
|
16035
|
+
this.host = rest.slice(0, hostEnd);
|
|
16036
|
+
rest = rest.slice(hostEnd);
|
|
16037
|
+
|
|
16038
|
+
// pull out port.
|
|
16039
|
+
this.parseHost();
|
|
16040
|
+
|
|
16041
|
+
// we've indicated that there is a hostname,
|
|
16042
|
+
// so even if it's empty, it has to be present.
|
|
16043
|
+
this.hostname = this.hostname || '';
|
|
16044
|
+
|
|
16045
|
+
// if hostname begins with [ and ends with ]
|
|
16046
|
+
// assume that it's an IPv6 address.
|
|
16047
|
+
var ipv6Hostname = this.hostname[0] === '[' &&
|
|
16048
|
+
this.hostname[this.hostname.length - 1] === ']';
|
|
16049
|
+
|
|
16050
|
+
// validate a little.
|
|
16051
|
+
if (!ipv6Hostname) {
|
|
16052
|
+
var hostparts = this.hostname.split(/\./);
|
|
16053
|
+
for (var i = 0, l = hostparts.length; i < l; i++) {
|
|
16054
|
+
var part = hostparts[i];
|
|
16055
|
+
if (!part) continue;
|
|
16056
|
+
if (!part.match(hostnamePartPattern)) {
|
|
16057
|
+
var newpart = '';
|
|
16058
|
+
for (var j = 0, k = part.length; j < k; j++) {
|
|
16059
|
+
if (part.charCodeAt(j) > 127) {
|
|
16060
|
+
// we replace non-ASCII char with a temporary placeholder
|
|
16061
|
+
// we need this to make sure size of hostname is not
|
|
16062
|
+
// broken by replacing non-ASCII by nothing
|
|
16063
|
+
newpart += 'x';
|
|
16064
|
+
} else {
|
|
16065
|
+
newpart += part[j];
|
|
16066
|
+
}
|
|
16067
|
+
}
|
|
16068
|
+
// we test again with ASCII char only
|
|
16069
|
+
if (!newpart.match(hostnamePartPattern)) {
|
|
16070
|
+
var validParts = hostparts.slice(0, i);
|
|
16071
|
+
var notHost = hostparts.slice(i + 1);
|
|
16072
|
+
var bit = part.match(hostnamePartStart);
|
|
16073
|
+
if (bit) {
|
|
16074
|
+
validParts.push(bit[1]);
|
|
16075
|
+
notHost.unshift(bit[2]);
|
|
16076
|
+
}
|
|
16077
|
+
if (notHost.length) {
|
|
16078
|
+
rest = '/' + notHost.join('.') + rest;
|
|
16079
|
+
}
|
|
16080
|
+
this.hostname = validParts.join('.');
|
|
16081
|
+
break;
|
|
16082
|
+
}
|
|
16083
|
+
}
|
|
16084
|
+
}
|
|
16085
|
+
}
|
|
16086
|
+
|
|
16087
|
+
if (this.hostname.length > hostnameMaxLen) {
|
|
16088
|
+
this.hostname = '';
|
|
16089
|
+
} else {
|
|
16090
|
+
// hostnames are always lower case.
|
|
16091
|
+
this.hostname = this.hostname.toLowerCase();
|
|
16092
|
+
}
|
|
16093
|
+
|
|
16094
|
+
if (!ipv6Hostname) {
|
|
16095
|
+
// IDNA Support: Returns a punycoded representation of "domain".
|
|
16096
|
+
// It only converts parts of the domain name that
|
|
16097
|
+
// have non-ASCII characters, i.e. it doesn't matter if
|
|
16098
|
+
// you call it with a domain that already is ASCII-only.
|
|
16099
|
+
this.hostname = punycode.toASCII(this.hostname);
|
|
16100
|
+
}
|
|
16101
|
+
|
|
16102
|
+
var p = this.port ? ':' + this.port : '';
|
|
16103
|
+
var h = this.hostname || '';
|
|
16104
|
+
this.host = h + p;
|
|
16105
|
+
this.href += this.host;
|
|
16106
|
+
|
|
16107
|
+
// strip [ and ] from the hostname
|
|
16108
|
+
// the host field still retains them, though
|
|
16109
|
+
if (ipv6Hostname) {
|
|
16110
|
+
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
|
16111
|
+
if (rest[0] !== '/') {
|
|
16112
|
+
rest = '/' + rest;
|
|
16113
|
+
}
|
|
16114
|
+
}
|
|
16115
|
+
}
|
|
16116
|
+
|
|
16117
|
+
// now rest is set to the post-host stuff.
|
|
16118
|
+
// chop off any delim chars.
|
|
16119
|
+
if (!unsafeProtocol[lowerProto]) {
|
|
16120
|
+
|
|
16121
|
+
// First, make 100% sure that any "autoEscape" chars get
|
|
16122
|
+
// escaped, even if encodeURIComponent doesn't think they
|
|
16123
|
+
// need to be.
|
|
16124
|
+
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
|
16125
|
+
var ae = autoEscape[i];
|
|
16126
|
+
if (rest.indexOf(ae) === -1)
|
|
16127
|
+
continue;
|
|
16128
|
+
var esc = encodeURIComponent(ae);
|
|
16129
|
+
if (esc === ae) {
|
|
16130
|
+
esc = escape(ae);
|
|
16131
|
+
}
|
|
16132
|
+
rest = rest.split(ae).join(esc);
|
|
16133
|
+
}
|
|
16134
|
+
}
|
|
16135
|
+
|
|
16136
|
+
|
|
16137
|
+
// chop off from the tail first.
|
|
16138
|
+
var hash = rest.indexOf('#');
|
|
16139
|
+
if (hash !== -1) {
|
|
16140
|
+
// got a fragment string.
|
|
16141
|
+
this.hash = rest.substr(hash);
|
|
16142
|
+
rest = rest.slice(0, hash);
|
|
16143
|
+
}
|
|
16144
|
+
var qm = rest.indexOf('?');
|
|
16145
|
+
if (qm !== -1) {
|
|
16146
|
+
this.search = rest.substr(qm);
|
|
16147
|
+
this.query = rest.substr(qm + 1);
|
|
16148
|
+
if (parseQueryString) {
|
|
16149
|
+
this.query = querystring.parse(this.query);
|
|
16150
|
+
}
|
|
16151
|
+
rest = rest.slice(0, qm);
|
|
16152
|
+
} else if (parseQueryString) {
|
|
16153
|
+
// no query string, but parseQueryString still requested
|
|
16154
|
+
this.search = '';
|
|
16155
|
+
this.query = {};
|
|
16156
|
+
}
|
|
16157
|
+
if (rest) this.pathname = rest;
|
|
16158
|
+
if (slashedProtocol[lowerProto] &&
|
|
16159
|
+
this.hostname && !this.pathname) {
|
|
16160
|
+
this.pathname = '/';
|
|
16161
|
+
}
|
|
16162
|
+
|
|
16163
|
+
//to support http.request
|
|
16164
|
+
if (this.pathname || this.search) {
|
|
16165
|
+
var p = this.pathname || '';
|
|
16166
|
+
var s = this.search || '';
|
|
16167
|
+
this.path = p + s;
|
|
16168
|
+
}
|
|
16169
|
+
|
|
16170
|
+
// finally, reconstruct the href based on what has been validated.
|
|
16171
|
+
this.href = this.format();
|
|
16172
|
+
return this;
|
|
16173
|
+
};
|
|
16174
|
+
|
|
16175
|
+
// format a parsed object into a url string
|
|
16176
|
+
function urlFormat(obj) {
|
|
16177
|
+
// ensure it's an object, and not a string url.
|
|
16178
|
+
// If it's an obj, this is a no-op.
|
|
16179
|
+
// this way, you can call url_format() on strings
|
|
16180
|
+
// to clean up potentially wonky urls.
|
|
16181
|
+
if (util.isString(obj)) obj = urlParse(obj);
|
|
16182
|
+
if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
|
16183
|
+
return obj.format();
|
|
16184
|
+
}
|
|
16185
|
+
|
|
16186
|
+
Url.prototype.format = function() {
|
|
16187
|
+
var auth = this.auth || '';
|
|
16188
|
+
if (auth) {
|
|
16189
|
+
auth = encodeURIComponent(auth);
|
|
16190
|
+
auth = auth.replace(/%3A/i, ':');
|
|
16191
|
+
auth += '@';
|
|
16192
|
+
}
|
|
16193
|
+
|
|
16194
|
+
var protocol = this.protocol || '',
|
|
16195
|
+
pathname = this.pathname || '',
|
|
16196
|
+
hash = this.hash || '',
|
|
16197
|
+
host = false,
|
|
16198
|
+
query = '';
|
|
16199
|
+
|
|
16200
|
+
if (this.host) {
|
|
16201
|
+
host = auth + this.host;
|
|
16202
|
+
} else if (this.hostname) {
|
|
16203
|
+
host = auth + (this.hostname.indexOf(':') === -1 ?
|
|
16204
|
+
this.hostname :
|
|
16205
|
+
'[' + this.hostname + ']');
|
|
16206
|
+
if (this.port) {
|
|
16207
|
+
host += ':' + this.port;
|
|
16208
|
+
}
|
|
16209
|
+
}
|
|
16210
|
+
|
|
16211
|
+
if (this.query &&
|
|
16212
|
+
util.isObject(this.query) &&
|
|
16213
|
+
Object.keys(this.query).length) {
|
|
16214
|
+
query = querystring.stringify(this.query);
|
|
16215
|
+
}
|
|
16216
|
+
|
|
16217
|
+
var search = this.search || (query && ('?' + query)) || '';
|
|
16218
|
+
|
|
16219
|
+
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
|
16220
|
+
|
|
16221
|
+
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
|
16222
|
+
// unless they had them to begin with.
|
|
16223
|
+
if (this.slashes ||
|
|
16224
|
+
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
|
16225
|
+
host = '//' + (host || '');
|
|
16226
|
+
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
|
16227
|
+
} else if (!host) {
|
|
16228
|
+
host = '';
|
|
16229
|
+
}
|
|
16230
|
+
|
|
16231
|
+
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
|
16232
|
+
if (search && search.charAt(0) !== '?') search = '?' + search;
|
|
16233
|
+
|
|
16234
|
+
pathname = pathname.replace(/[?#]/g, function(match) {
|
|
16235
|
+
return encodeURIComponent(match);
|
|
16236
|
+
});
|
|
16237
|
+
search = search.replace('#', '%23');
|
|
16238
|
+
|
|
16239
|
+
return protocol + host + pathname + search + hash;
|
|
16240
|
+
};
|
|
16241
|
+
|
|
16242
|
+
function urlResolve(source, relative) {
|
|
16243
|
+
return urlParse(source, false, true).resolve(relative);
|
|
16244
|
+
}
|
|
16245
|
+
|
|
16246
|
+
Url.prototype.resolve = function(relative) {
|
|
16247
|
+
return this.resolveObject(urlParse(relative, false, true)).format();
|
|
16248
|
+
};
|
|
16249
|
+
|
|
16250
|
+
function urlResolveObject(source, relative) {
|
|
16251
|
+
if (!source) return relative;
|
|
16252
|
+
return urlParse(source, false, true).resolveObject(relative);
|
|
16253
|
+
}
|
|
16254
|
+
|
|
16255
|
+
Url.prototype.resolveObject = function(relative) {
|
|
16256
|
+
if (util.isString(relative)) {
|
|
16257
|
+
var rel = new Url();
|
|
16258
|
+
rel.parse(relative, false, true);
|
|
16259
|
+
relative = rel;
|
|
16260
|
+
}
|
|
16261
|
+
|
|
16262
|
+
var result = new Url();
|
|
16263
|
+
var tkeys = Object.keys(this);
|
|
16264
|
+
for (var tk = 0; tk < tkeys.length; tk++) {
|
|
16265
|
+
var tkey = tkeys[tk];
|
|
16266
|
+
result[tkey] = this[tkey];
|
|
16267
|
+
}
|
|
16268
|
+
|
|
16269
|
+
// hash is always overridden, no matter what.
|
|
16270
|
+
// even href="" will remove it.
|
|
16271
|
+
result.hash = relative.hash;
|
|
16272
|
+
|
|
16273
|
+
// if the relative url is empty, then there's nothing left to do here.
|
|
16274
|
+
if (relative.href === '') {
|
|
16275
|
+
result.href = result.format();
|
|
16276
|
+
return result;
|
|
16277
|
+
}
|
|
16278
|
+
|
|
16279
|
+
// hrefs like //foo/bar always cut to the protocol.
|
|
16280
|
+
if (relative.slashes && !relative.protocol) {
|
|
16281
|
+
// take everything except the protocol from relative
|
|
16282
|
+
var rkeys = Object.keys(relative);
|
|
16283
|
+
for (var rk = 0; rk < rkeys.length; rk++) {
|
|
16284
|
+
var rkey = rkeys[rk];
|
|
16285
|
+
if (rkey !== 'protocol')
|
|
16286
|
+
result[rkey] = relative[rkey];
|
|
16287
|
+
}
|
|
16288
|
+
|
|
16289
|
+
//urlParse appends trailing / to urls like http://www.example.com
|
|
16290
|
+
if (slashedProtocol[result.protocol] &&
|
|
16291
|
+
result.hostname && !result.pathname) {
|
|
16292
|
+
result.path = result.pathname = '/';
|
|
16293
|
+
}
|
|
16294
|
+
|
|
16295
|
+
result.href = result.format();
|
|
16296
|
+
return result;
|
|
16297
|
+
}
|
|
16298
|
+
|
|
16299
|
+
if (relative.protocol && relative.protocol !== result.protocol) {
|
|
16300
|
+
// if it's a known url protocol, then changing
|
|
16301
|
+
// the protocol does weird things
|
|
16302
|
+
// first, if it's not file:, then we MUST have a host,
|
|
16303
|
+
// and if there was a path
|
|
16304
|
+
// to begin with, then we MUST have a path.
|
|
16305
|
+
// if it is file:, then the host is dropped,
|
|
16306
|
+
// because that's known to be hostless.
|
|
16307
|
+
// anything else is assumed to be absolute.
|
|
16308
|
+
if (!slashedProtocol[relative.protocol]) {
|
|
16309
|
+
var keys = Object.keys(relative);
|
|
16310
|
+
for (var v = 0; v < keys.length; v++) {
|
|
16311
|
+
var k = keys[v];
|
|
16312
|
+
result[k] = relative[k];
|
|
16313
|
+
}
|
|
16314
|
+
result.href = result.format();
|
|
16315
|
+
return result;
|
|
16316
|
+
}
|
|
16317
|
+
|
|
16318
|
+
result.protocol = relative.protocol;
|
|
16319
|
+
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
|
16320
|
+
var relPath = (relative.pathname || '').split('/');
|
|
16321
|
+
while (relPath.length && !(relative.host = relPath.shift()));
|
|
16322
|
+
if (!relative.host) relative.host = '';
|
|
16323
|
+
if (!relative.hostname) relative.hostname = '';
|
|
16324
|
+
if (relPath[0] !== '') relPath.unshift('');
|
|
16325
|
+
if (relPath.length < 2) relPath.unshift('');
|
|
16326
|
+
result.pathname = relPath.join('/');
|
|
16327
|
+
} else {
|
|
16328
|
+
result.pathname = relative.pathname;
|
|
16329
|
+
}
|
|
16330
|
+
result.search = relative.search;
|
|
16331
|
+
result.query = relative.query;
|
|
16332
|
+
result.host = relative.host || '';
|
|
16333
|
+
result.auth = relative.auth;
|
|
16334
|
+
result.hostname = relative.hostname || relative.host;
|
|
16335
|
+
result.port = relative.port;
|
|
16336
|
+
// to support http.request
|
|
16337
|
+
if (result.pathname || result.search) {
|
|
16338
|
+
var p = result.pathname || '';
|
|
16339
|
+
var s = result.search || '';
|
|
16340
|
+
result.path = p + s;
|
|
16341
|
+
}
|
|
16342
|
+
result.slashes = result.slashes || relative.slashes;
|
|
16343
|
+
result.href = result.format();
|
|
16344
|
+
return result;
|
|
16345
|
+
}
|
|
16346
|
+
|
|
16347
|
+
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
|
16348
|
+
isRelAbs = (
|
|
16349
|
+
relative.host ||
|
|
16350
|
+
relative.pathname && relative.pathname.charAt(0) === '/'
|
|
16351
|
+
),
|
|
16352
|
+
mustEndAbs = (isRelAbs || isSourceAbs ||
|
|
16353
|
+
(result.host && relative.pathname)),
|
|
16354
|
+
removeAllDots = mustEndAbs,
|
|
16355
|
+
srcPath = result.pathname && result.pathname.split('/') || [],
|
|
16356
|
+
relPath = relative.pathname && relative.pathname.split('/') || [],
|
|
16357
|
+
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
|
16358
|
+
|
|
16359
|
+
// if the url is a non-slashed url, then relative
|
|
16360
|
+
// links like ../.. should be able
|
|
16361
|
+
// to crawl up to the hostname, as well. This is strange.
|
|
16362
|
+
// result.protocol has already been set by now.
|
|
16363
|
+
// Later on, put the first path part into the host field.
|
|
16364
|
+
if (psychotic) {
|
|
16365
|
+
result.hostname = '';
|
|
16366
|
+
result.port = null;
|
|
16367
|
+
if (result.host) {
|
|
16368
|
+
if (srcPath[0] === '') srcPath[0] = result.host;
|
|
16369
|
+
else srcPath.unshift(result.host);
|
|
16370
|
+
}
|
|
16371
|
+
result.host = '';
|
|
16372
|
+
if (relative.protocol) {
|
|
16373
|
+
relative.hostname = null;
|
|
16374
|
+
relative.port = null;
|
|
16375
|
+
if (relative.host) {
|
|
16376
|
+
if (relPath[0] === '') relPath[0] = relative.host;
|
|
16377
|
+
else relPath.unshift(relative.host);
|
|
16378
|
+
}
|
|
16379
|
+
relative.host = null;
|
|
16380
|
+
}
|
|
16381
|
+
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
|
16382
|
+
}
|
|
16383
|
+
|
|
16384
|
+
if (isRelAbs) {
|
|
16385
|
+
// it's absolute.
|
|
16386
|
+
result.host = (relative.host || relative.host === '') ?
|
|
16387
|
+
relative.host : result.host;
|
|
16388
|
+
result.hostname = (relative.hostname || relative.hostname === '') ?
|
|
16389
|
+
relative.hostname : result.hostname;
|
|
16390
|
+
result.search = relative.search;
|
|
16391
|
+
result.query = relative.query;
|
|
16392
|
+
srcPath = relPath;
|
|
16393
|
+
// fall through to the dot-handling below.
|
|
16394
|
+
} else if (relPath.length) {
|
|
16395
|
+
// it's relative
|
|
16396
|
+
// throw away the existing file, and take the new path instead.
|
|
16397
|
+
if (!srcPath) srcPath = [];
|
|
16398
|
+
srcPath.pop();
|
|
16399
|
+
srcPath = srcPath.concat(relPath);
|
|
16400
|
+
result.search = relative.search;
|
|
16401
|
+
result.query = relative.query;
|
|
16402
|
+
} else if (!util.isNullOrUndefined(relative.search)) {
|
|
16403
|
+
// just pull out the search.
|
|
16404
|
+
// like href='?foo'.
|
|
16405
|
+
// Put this after the other two cases because it simplifies the booleans
|
|
16406
|
+
if (psychotic) {
|
|
16407
|
+
result.hostname = result.host = srcPath.shift();
|
|
16408
|
+
//occationaly the auth can get stuck only in host
|
|
16409
|
+
//this especially happens in cases like
|
|
16410
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
16411
|
+
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
16412
|
+
result.host.split('@') : false;
|
|
16413
|
+
if (authInHost) {
|
|
16414
|
+
result.auth = authInHost.shift();
|
|
16415
|
+
result.host = result.hostname = authInHost.shift();
|
|
16416
|
+
}
|
|
16417
|
+
}
|
|
16418
|
+
result.search = relative.search;
|
|
16419
|
+
result.query = relative.query;
|
|
16420
|
+
//to support http.request
|
|
16421
|
+
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
|
16422
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
16423
|
+
(result.search ? result.search : '');
|
|
16424
|
+
}
|
|
16425
|
+
result.href = result.format();
|
|
16426
|
+
return result;
|
|
16427
|
+
}
|
|
16428
|
+
|
|
16429
|
+
if (!srcPath.length) {
|
|
16430
|
+
// no path at all. easy.
|
|
16431
|
+
// we've already handled the other stuff above.
|
|
16432
|
+
result.pathname = null;
|
|
16433
|
+
//to support http.request
|
|
16434
|
+
if (result.search) {
|
|
16435
|
+
result.path = '/' + result.search;
|
|
16436
|
+
} else {
|
|
16437
|
+
result.path = null;
|
|
16438
|
+
}
|
|
16439
|
+
result.href = result.format();
|
|
16440
|
+
return result;
|
|
16441
|
+
}
|
|
16442
|
+
|
|
16443
|
+
// if a url ENDs in . or .., then it must get a trailing slash.
|
|
16444
|
+
// however, if it ends in anything else non-slashy,
|
|
16445
|
+
// then it must NOT get a trailing slash.
|
|
16446
|
+
var last = srcPath.slice(-1)[0];
|
|
16447
|
+
var hasTrailingSlash = (
|
|
16448
|
+
(result.host || relative.host || srcPath.length > 1) &&
|
|
16449
|
+
(last === '.' || last === '..') || last === '');
|
|
16450
|
+
|
|
16451
|
+
// strip single dots, resolve double dots to parent dir
|
|
16452
|
+
// if the path tries to go above the root, `up` ends up > 0
|
|
16453
|
+
var up = 0;
|
|
16454
|
+
for (var i = srcPath.length; i >= 0; i--) {
|
|
16455
|
+
last = srcPath[i];
|
|
16456
|
+
if (last === '.') {
|
|
16457
|
+
srcPath.splice(i, 1);
|
|
16458
|
+
} else if (last === '..') {
|
|
16459
|
+
srcPath.splice(i, 1);
|
|
16460
|
+
up++;
|
|
16461
|
+
} else if (up) {
|
|
16462
|
+
srcPath.splice(i, 1);
|
|
16463
|
+
up--;
|
|
16464
|
+
}
|
|
16465
|
+
}
|
|
16466
|
+
|
|
16467
|
+
// if the path is allowed to go above the root, restore leading ..s
|
|
16468
|
+
if (!mustEndAbs && !removeAllDots) {
|
|
16469
|
+
for (; up--; up) {
|
|
16470
|
+
srcPath.unshift('..');
|
|
16471
|
+
}
|
|
16472
|
+
}
|
|
16473
|
+
|
|
16474
|
+
if (mustEndAbs && srcPath[0] !== '' &&
|
|
16475
|
+
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
|
16476
|
+
srcPath.unshift('');
|
|
16477
|
+
}
|
|
16478
|
+
|
|
16479
|
+
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
|
16480
|
+
srcPath.push('');
|
|
16481
|
+
}
|
|
16482
|
+
|
|
16483
|
+
var isAbsolute = srcPath[0] === '' ||
|
|
16484
|
+
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
|
16485
|
+
|
|
16486
|
+
// put the host back
|
|
16487
|
+
if (psychotic) {
|
|
16488
|
+
result.hostname = result.host = isAbsolute ? '' :
|
|
16489
|
+
srcPath.length ? srcPath.shift() : '';
|
|
16490
|
+
//occationaly the auth can get stuck only in host
|
|
16491
|
+
//this especially happens in cases like
|
|
16492
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
16493
|
+
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
16494
|
+
result.host.split('@') : false;
|
|
16495
|
+
if (authInHost) {
|
|
16496
|
+
result.auth = authInHost.shift();
|
|
16497
|
+
result.host = result.hostname = authInHost.shift();
|
|
16498
|
+
}
|
|
16499
|
+
}
|
|
16500
|
+
|
|
16501
|
+
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
|
16502
|
+
|
|
16503
|
+
if (mustEndAbs && !isAbsolute) {
|
|
16504
|
+
srcPath.unshift('');
|
|
16505
|
+
}
|
|
16506
|
+
|
|
16507
|
+
if (!srcPath.length) {
|
|
16508
|
+
result.pathname = null;
|
|
16509
|
+
result.path = null;
|
|
16510
|
+
} else {
|
|
16511
|
+
result.pathname = srcPath.join('/');
|
|
16512
|
+
}
|
|
16513
|
+
|
|
16514
|
+
//to support request.http
|
|
16515
|
+
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
|
16516
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
16517
|
+
(result.search ? result.search : '');
|
|
16518
|
+
}
|
|
16519
|
+
result.auth = relative.auth || result.auth;
|
|
16520
|
+
result.slashes = result.slashes || relative.slashes;
|
|
16521
|
+
result.href = result.format();
|
|
16522
|
+
return result;
|
|
16523
|
+
};
|
|
16524
|
+
|
|
16525
|
+
Url.prototype.parseHost = function() {
|
|
16526
|
+
var host = this.host;
|
|
16527
|
+
var port = portPattern.exec(host);
|
|
16528
|
+
if (port) {
|
|
16529
|
+
port = port[0];
|
|
16530
|
+
if (port !== ':') {
|
|
16531
|
+
this.port = port.substr(1);
|
|
16532
|
+
}
|
|
16533
|
+
host = host.substr(0, host.length - port.length);
|
|
16534
|
+
}
|
|
16535
|
+
if (host) this.hostname = host;
|
|
16536
|
+
};
|
|
16537
|
+
|
|
16538
|
+
},{"./util":70,"punycode":45,"querystring":48}],70:[function(require,module,exports){
|
|
16539
|
+
'use strict';
|
|
16540
|
+
|
|
16541
|
+
module.exports = {
|
|
16542
|
+
isString: function(arg) {
|
|
16543
|
+
return typeof(arg) === 'string';
|
|
16544
|
+
},
|
|
16545
|
+
isObject: function(arg) {
|
|
16546
|
+
return typeof(arg) === 'object' && arg !== null;
|
|
16547
|
+
},
|
|
16548
|
+
isNull: function(arg) {
|
|
16549
|
+
return arg === null;
|
|
16550
|
+
},
|
|
16551
|
+
isNullOrUndefined: function(arg) {
|
|
16552
|
+
return arg == null;
|
|
16553
|
+
}
|
|
16554
|
+
};
|
|
16555
|
+
|
|
16556
|
+
},{}],71:[function(require,module,exports){
|
|
15102
16557
|
(function (global){
|
|
15103
16558
|
|
|
15104
16559
|
/**
|
|
@@ -15169,7 +16624,7 @@ function config (name) {
|
|
|
15169
16624
|
}
|
|
15170
16625
|
|
|
15171
16626
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
15172
|
-
},{}],
|
|
16627
|
+
},{}],72:[function(require,module,exports){
|
|
15173
16628
|
// Returns a wrapper function that returns a wrapped callback
|
|
15174
16629
|
// The wrapper function should do some stuff, and return a
|
|
15175
16630
|
// presumably different callback function.
|
|
@@ -15204,7 +16659,7 @@ function wrappy (fn, cb) {
|
|
|
15204
16659
|
}
|
|
15205
16660
|
}
|
|
15206
16661
|
|
|
15207
|
-
},{}],
|
|
16662
|
+
},{}],73:[function(require,module,exports){
|
|
15208
16663
|
'use strict';
|
|
15209
16664
|
|
|
15210
16665
|
module.exports = function () {
|
|
@@ -15214,7 +16669,7 @@ module.exports = function () {
|
|
|
15214
16669
|
);
|
|
15215
16670
|
};
|
|
15216
16671
|
|
|
15217
|
-
},{}],
|
|
16672
|
+
},{}],74:[function(require,module,exports){
|
|
15218
16673
|
module.exports = extend
|
|
15219
16674
|
|
|
15220
16675
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|