$
This commit is contained in:
14
node_modules/spdy-transport/.travis.yml
generated
vendored
Normal file
14
node_modules/spdy-transport/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "6"
|
||||
- "8"
|
||||
- "10"
|
||||
- "stable"
|
||||
|
||||
script:
|
||||
- npm run lint
|
||||
- npm test
|
||||
- npm run coverage
|
76
node_modules/spdy-transport/README.md
generated
vendored
Normal file
76
node_modules/spdy-transport/README.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# spdy-transport
|
||||
|
||||
[](http://travis-ci.org/spdy-http2/spdy-transport)
|
||||
[](http://badge.fury.io/js/spdy-transport)
|
||||
[](https://david-dm.org/spdy-http2/spdy-transport)
|
||||
[](http://standardjs.com/)
|
||||
[](https://waffle.io/spdy-http2/node-spdy)
|
||||
|
||||
> SPDY/HTTP2 generic transport implementation.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var transport = require('spdy-transport');
|
||||
|
||||
// NOTE: socket is some stream or net.Socket instance, may be an argument
|
||||
// of `net.createServer`'s connection handler.
|
||||
|
||||
var server = transport.connection.create(socket, {
|
||||
protocol: 'http2',
|
||||
isServer: true
|
||||
});
|
||||
|
||||
server.on('stream', function(stream) {
|
||||
console.log(stream.method, stream.path, stream.headers);
|
||||
stream.respond(200, {
|
||||
header: 'value'
|
||||
});
|
||||
|
||||
stream.on('readable', function() {
|
||||
var chunk = stream.read();
|
||||
if (!chunk)
|
||||
return;
|
||||
|
||||
console.log(chunk);
|
||||
});
|
||||
|
||||
stream.on('end', function() {
|
||||
console.log('end');
|
||||
});
|
||||
|
||||
// And other node.js Stream APIs
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
This software is licensed under the MIT License.
|
||||
|
||||
Copyright Fedor Indutny, 2015.
|
||||
|
||||
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.
|
||||
|
||||
[0]: http://json.org/
|
||||
[1]: http://github.com/indutny/bud-backend
|
||||
[2]: https://github.com/nodejs/io.js
|
||||
[3]: https://github.com/libuv/libuv
|
||||
[4]: http://openssl.org/
|
25
node_modules/spdy-transport/lib/spdy-transport.js
generated
vendored
Normal file
25
node_modules/spdy-transport/lib/spdy-transport.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
var transport = exports
|
||||
|
||||
// Exports utils
|
||||
transport.utils = require('./spdy-transport/utils')
|
||||
|
||||
// Export parser&framer
|
||||
transport.protocol = {}
|
||||
transport.protocol.base = require('./spdy-transport/protocol/base')
|
||||
transport.protocol.spdy = require('./spdy-transport/protocol/spdy')
|
||||
transport.protocol.http2 = require('./spdy-transport/protocol/http2')
|
||||
|
||||
// Window
|
||||
transport.Window = require('./spdy-transport/window')
|
||||
|
||||
// Priority Tree
|
||||
transport.Priority = require('./spdy-transport/priority')
|
||||
|
||||
// Export Connection and Stream
|
||||
transport.Stream = require('./spdy-transport/stream').Stream
|
||||
transport.Connection = require('./spdy-transport/connection').Connection
|
||||
|
||||
// Just for `transport.connection.create()`
|
||||
transport.connection = transport.Connection
|
845
node_modules/spdy-transport/lib/spdy-transport/connection.js
generated
vendored
Normal file
845
node_modules/spdy-transport/lib/spdy-transport/connection.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
188
node_modules/spdy-transport/lib/spdy-transport/priority.js
generated
vendored
Normal file
188
node_modules/spdy-transport/lib/spdy-transport/priority.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
'use strict'
|
||||
|
||||
var transport = require('../spdy-transport')
|
||||
var utils = transport.utils
|
||||
|
||||
var assert = require('assert')
|
||||
var debug = require('debug')('spdy:priority')
|
||||
|
||||
function PriorityNode (tree, options) {
|
||||
this.tree = tree
|
||||
|
||||
this.id = options.id
|
||||
this.parent = options.parent
|
||||
this.weight = options.weight
|
||||
|
||||
// To be calculated in `addChild`
|
||||
this.priorityFrom = 0
|
||||
this.priorityTo = 1
|
||||
this.priority = 1
|
||||
|
||||
this.children = {
|
||||
list: [],
|
||||
weight: 0
|
||||
}
|
||||
|
||||
if (this.parent !== null) {
|
||||
this.parent.addChild(this)
|
||||
}
|
||||
}
|
||||
|
||||
function compareChildren (a, b) {
|
||||
return a.weight === b.weight ? a.id - b.id : a.weight - b.weight
|
||||
}
|
||||
|
||||
PriorityNode.prototype.toJSON = function toJSON () {
|
||||
return {
|
||||
parent: this.parent,
|
||||
weight: this.weight,
|
||||
exclusive: this.exclusive
|
||||
}
|
||||
}
|
||||
|
||||
PriorityNode.prototype.getPriority = function getPriority () {
|
||||
return this.priority
|
||||
}
|
||||
|
||||
PriorityNode.prototype.getPriorityRange = function getPriorityRange () {
|
||||
return { from: this.priorityFrom, to: this.priorityTo }
|
||||
}
|
||||
|
||||
PriorityNode.prototype.addChild = function addChild (child) {
|
||||
child.parent = this
|
||||
utils.binaryInsert(this.children.list, child, compareChildren)
|
||||
this.children.weight += child.weight
|
||||
|
||||
this._updatePriority(this.priorityFrom, this.priorityTo)
|
||||
}
|
||||
|
||||
PriorityNode.prototype.remove = function remove () {
|
||||
assert(this.parent, 'Can\'t remove root node')
|
||||
|
||||
this.parent.removeChild(this)
|
||||
this.tree._removeNode(this)
|
||||
|
||||
// Move all children to the parent
|
||||
for (var i = 0; i < this.children.list.length; i++) {
|
||||
this.parent.addChild(this.children.list[i])
|
||||
}
|
||||
}
|
||||
|
||||
PriorityNode.prototype.removeChild = function removeChild (child) {
|
||||
this.children.weight -= child.weight
|
||||
var index = utils.binarySearch(this.children.list, child, compareChildren)
|
||||
if (index !== -1 && this.children.list.length >= index) {
|
||||
this.children.list.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
PriorityNode.prototype.removeChildren = function removeChildren () {
|
||||
var children = this.children.list
|
||||
this.children.list = []
|
||||
this.children.weight = 0
|
||||
return children
|
||||
}
|
||||
|
||||
PriorityNode.prototype._updatePriority = function _updatePriority (from, to) {
|
||||
this.priority = to - from
|
||||
this.priorityFrom = from
|
||||
this.priorityTo = to
|
||||
|
||||
var weight = 0
|
||||
for (var i = 0; i < this.children.list.length; i++) {
|
||||
var node = this.children.list[i]
|
||||
var nextWeight = weight + node.weight
|
||||
|
||||
node._updatePriority(
|
||||
from + this.priority * (weight / this.children.weight),
|
||||
from + this.priority * (nextWeight / this.children.weight)
|
||||
)
|
||||
weight = nextWeight
|
||||
}
|
||||
}
|
||||
|
||||
function PriorityTree (options) {
|
||||
this.map = {}
|
||||
this.list = []
|
||||
this.defaultWeight = options.defaultWeight || 16
|
||||
|
||||
this.count = 0
|
||||
this.maxCount = options.maxCount
|
||||
|
||||
// Root
|
||||
this.root = this.add({
|
||||
id: 0,
|
||||
parent: null,
|
||||
weight: 1
|
||||
})
|
||||
}
|
||||
module.exports = PriorityTree
|
||||
|
||||
PriorityTree.create = function create (options) {
|
||||
return new PriorityTree(options)
|
||||
}
|
||||
|
||||
PriorityTree.prototype.add = function add (options) {
|
||||
if (options.id === options.parent) {
|
||||
return this.addDefault(options.id)
|
||||
}
|
||||
|
||||
var parent = options.parent === null ? null : this.map[options.parent]
|
||||
if (parent === undefined) {
|
||||
return this.addDefault(options.id)
|
||||
}
|
||||
|
||||
debug('add node=%d parent=%d weight=%d exclusive=%d',
|
||||
options.id,
|
||||
options.parent === null ? -1 : options.parent,
|
||||
options.weight || this.defaultWeight,
|
||||
options.exclusive ? 1 : 0)
|
||||
|
||||
var children
|
||||
if (options.exclusive) {
|
||||
children = parent.removeChildren()
|
||||
}
|
||||
|
||||
var node = new PriorityNode(this, {
|
||||
id: options.id,
|
||||
parent: parent,
|
||||
weight: options.weight || this.defaultWeight
|
||||
})
|
||||
this.map[options.id] = node
|
||||
|
||||
if (options.exclusive) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
node.addChild(children[i])
|
||||
}
|
||||
}
|
||||
|
||||
this.count++
|
||||
if (this.count > this.maxCount) {
|
||||
debug('hit maximum remove id=%d', this.list[0].id)
|
||||
this.list.shift().remove()
|
||||
}
|
||||
|
||||
// Root node is not subject to removal
|
||||
if (node.parent !== null) {
|
||||
this.list.push(node)
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
|
||||
// Only for testing, should use `node`'s methods
|
||||
PriorityTree.prototype.get = function get (id) {
|
||||
return this.map[id]
|
||||
}
|
||||
|
||||
PriorityTree.prototype.addDefault = function addDefault (id) {
|
||||
debug('creating default node')
|
||||
return this.add({ id: id, parent: 0, weight: this.defaultWeight })
|
||||
}
|
||||
|
||||
PriorityTree.prototype._removeNode = function _removeNode (node) {
|
||||
delete this.map[node.id]
|
||||
var index = utils.binarySearch(this.list, node, compareChildren)
|
||||
this.list.splice(index, 1)
|
||||
this.count--
|
||||
}
|
4
node_modules/spdy-transport/lib/spdy-transport/protocol/base/constants.js
generated
vendored
Normal file
4
node_modules/spdy-transport/lib/spdy-transport/protocol/base/constants.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
exports.DEFAULT_METHOD = 'GET'
|
||||
exports.DEFAULT_HOST = 'localhost'
|
||||
exports.MAX_PRIORITY_STREAMS = 100
|
||||
exports.DEFAULT_MAX_CHUNK = 8 * 1024
|
58
node_modules/spdy-transport/lib/spdy-transport/protocol/base/framer.js
generated
vendored
Normal file
58
node_modules/spdy-transport/lib/spdy-transport/protocol/base/framer.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
var base = require('./')
|
||||
var Scheduler = base.Scheduler
|
||||
|
||||
function Framer (options) {
|
||||
Scheduler.call(this)
|
||||
|
||||
this.version = null
|
||||
this.compress = null
|
||||
this.window = options.window
|
||||
this.timeout = options.timeout
|
||||
|
||||
// Wait for `enablePush`
|
||||
this.pushEnabled = null
|
||||
}
|
||||
util.inherits(Framer, Scheduler)
|
||||
module.exports = Framer
|
||||
|
||||
Framer.prototype.setVersion = function setVersion (version) {
|
||||
this.version = version
|
||||
this.emit('version')
|
||||
}
|
||||
|
||||
Framer.prototype.setCompression = function setCompresion (pair) {
|
||||
this.compress = new transport.utils.LockStream(pair.compress)
|
||||
}
|
||||
|
||||
Framer.prototype.enablePush = function enablePush (enable) {
|
||||
this.pushEnabled = enable
|
||||
this.emit('_pushEnabled')
|
||||
}
|
||||
|
||||
Framer.prototype._checkPush = function _checkPush (callback) {
|
||||
if (this.pushEnabled === null) {
|
||||
this.once('_pushEnabled', function () {
|
||||
this._checkPush(callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
var err = null
|
||||
if (!this.pushEnabled) {
|
||||
err = new Error('PUSH_PROMISE disabled by other side')
|
||||
}
|
||||
process.nextTick(function () {
|
||||
return callback(err)
|
||||
})
|
||||
}
|
||||
|
||||
Framer.prototype._resetTimeout = function _resetTimeout () {
|
||||
if (this.timeout) {
|
||||
this.timeout.reset()
|
||||
}
|
||||
}
|
7
node_modules/spdy-transport/lib/spdy-transport/protocol/base/index.js
generated
vendored
Normal file
7
node_modules/spdy-transport/lib/spdy-transport/protocol/base/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
exports.utils = require('./utils')
|
||||
exports.constants = require('./constants')
|
||||
exports.Scheduler = require('./scheduler')
|
||||
exports.Parser = require('./parser')
|
||||
exports.Framer = require('./framer')
|
106
node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js
generated
vendored
Normal file
106
node_modules/spdy-transport/lib/spdy-transport/protocol/base/parser.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
'use strict'
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
|
||||
var util = require('util')
|
||||
var utils = require('./').utils
|
||||
var OffsetBuffer = require('obuf')
|
||||
var Transform = require('readable-stream').Transform
|
||||
|
||||
function Parser (options) {
|
||||
Transform.call(this, {
|
||||
readableObjectMode: true
|
||||
})
|
||||
|
||||
this.buffer = new OffsetBuffer()
|
||||
this.partial = false
|
||||
this.waiting = 0
|
||||
|
||||
this.window = options.window
|
||||
|
||||
this.version = null
|
||||
this.decompress = null
|
||||
this.dead = false
|
||||
}
|
||||
module.exports = Parser
|
||||
util.inherits(Parser, Transform)
|
||||
|
||||
Parser.prototype.error = utils.error
|
||||
|
||||
Parser.prototype.kill = function kill () {
|
||||
this.dead = true
|
||||
}
|
||||
|
||||
Parser.prototype._transform = function transform (data, encoding, cb) {
|
||||
if (!this.dead) { this.buffer.push(data) }
|
||||
|
||||
this._consume(cb)
|
||||
}
|
||||
|
||||
Parser.prototype._consume = function _consume (cb) {
|
||||
var self = this
|
||||
|
||||
function next (err, frame) {
|
||||
if (err) {
|
||||
return cb(err)
|
||||
}
|
||||
|
||||
if (Array.isArray(frame)) {
|
||||
for (var i = 0; i < frame.length; i++) {
|
||||
self.push(frame[i])
|
||||
}
|
||||
} else if (frame) {
|
||||
self.push(frame)
|
||||
}
|
||||
|
||||
// Consume more packets
|
||||
if (!sync) {
|
||||
return self._consume(cb)
|
||||
}
|
||||
|
||||
process.nextTick(function () {
|
||||
self._consume(cb)
|
||||
})
|
||||
}
|
||||
|
||||
if (this.dead) {
|
||||
return cb()
|
||||
}
|
||||
|
||||
if (this.buffer.size < this.waiting) {
|
||||
// No data at all
|
||||
if (this.buffer.size === 0) {
|
||||
return cb()
|
||||
}
|
||||
|
||||
// Partial DATA frame or something that we can process partially
|
||||
if (this.partial) {
|
||||
var partial = this.buffer.clone(this.buffer.size)
|
||||
this.buffer.skip(partial.size)
|
||||
this.waiting -= partial.size
|
||||
|
||||
this.executePartial(partial, next)
|
||||
return
|
||||
}
|
||||
|
||||
// We shall not do anything until we get all expected data
|
||||
return cb()
|
||||
}
|
||||
|
||||
var sync = true
|
||||
|
||||
var content = this.buffer.clone(this.waiting)
|
||||
this.buffer.skip(this.waiting)
|
||||
|
||||
this.execute(content, next)
|
||||
sync = false
|
||||
}
|
||||
|
||||
Parser.prototype.setVersion = function setVersion (version) {
|
||||
this.version = version
|
||||
this.emit('version', version)
|
||||
}
|
||||
|
||||
Parser.prototype.setCompression = function setCompresion (pair) {
|
||||
this.decompress = new transport.utils.LockStream(pair.decompress)
|
||||
}
|
216
node_modules/spdy-transport/lib/spdy-transport/protocol/base/scheduler.js
generated
vendored
Normal file
216
node_modules/spdy-transport/lib/spdy-transport/protocol/base/scheduler.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
'use strict'
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
var utils = transport.utils
|
||||
|
||||
var assert = require('assert')
|
||||
var util = require('util')
|
||||
var debug = require('debug')('spdy:scheduler')
|
||||
var Readable = require('readable-stream').Readable
|
||||
|
||||
/*
|
||||
* We create following structure in `pending`:
|
||||
* [ [ id = 0 ], [ id = 1 ], [ id = 2 ], [ id = 0 ] ]
|
||||
* chunks chunks chunks chunks
|
||||
* chunks chunks
|
||||
* chunks
|
||||
*
|
||||
* Then on the `.tick()` pass we pick one chunks from each item and remove the
|
||||
* item if it is empty:
|
||||
*
|
||||
* [ [ id = 0 ], [ id = 2 ] ]
|
||||
* chunks chunks
|
||||
* chunks
|
||||
*
|
||||
* Writing out: chunks for 0, chunks for 1, chunks for 2, chunks for 0
|
||||
*
|
||||
* This way data is interleaved between the different streams.
|
||||
*/
|
||||
|
||||
function Scheduler (options) {
|
||||
Readable.call(this)
|
||||
|
||||
// Pretty big window by default
|
||||
this.window = 0.25
|
||||
|
||||
if (options && options.window) { this.window = options.window }
|
||||
|
||||
this.sync = []
|
||||
this.list = []
|
||||
this.count = 0
|
||||
this.pendingTick = false
|
||||
}
|
||||
util.inherits(Scheduler, Readable)
|
||||
module.exports = Scheduler
|
||||
|
||||
// Just for testing, really
|
||||
Scheduler.create = function create (options) {
|
||||
return new Scheduler(options)
|
||||
}
|
||||
|
||||
function insertCompare (a, b) {
|
||||
return a.priority === b.priority
|
||||
? a.stream - b.stream
|
||||
: b.priority - a.priority
|
||||
}
|
||||
|
||||
Scheduler.prototype.schedule = function schedule (data) {
|
||||
var priority = data.priority
|
||||
var stream = data.stream
|
||||
var chunks = data.chunks
|
||||
|
||||
// Synchronous frames should not be interleaved
|
||||
if (priority === false) {
|
||||
debug('queue sync', chunks)
|
||||
this.sync.push(data)
|
||||
this.count += chunks.length
|
||||
|
||||
this._read()
|
||||
return
|
||||
}
|
||||
|
||||
debug('queue async priority=%d stream=%d', priority, stream, chunks)
|
||||
var item = new SchedulerItem(stream, priority)
|
||||
var index = utils.binaryLookup(this.list, item, insertCompare)
|
||||
|
||||
// Push new item
|
||||
if (index >= this.list.length || insertCompare(this.list[index], item) !== 0) {
|
||||
this.list.splice(index, 0, item)
|
||||
} else { // Coalesce
|
||||
item = this.list[index]
|
||||
}
|
||||
|
||||
item.push(data)
|
||||
|
||||
this.count += chunks.length
|
||||
|
||||
this._read()
|
||||
}
|
||||
|
||||
Scheduler.prototype._read = function _read () {
|
||||
if (this.count === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.pendingTick) {
|
||||
return
|
||||
}
|
||||
this.pendingTick = true
|
||||
|
||||
var self = this
|
||||
process.nextTick(function () {
|
||||
self.pendingTick = false
|
||||
self.tick()
|
||||
})
|
||||
}
|
||||
|
||||
Scheduler.prototype.tick = function tick () {
|
||||
// No luck for async frames
|
||||
if (!this.tickSync()) { return false }
|
||||
|
||||
return this.tickAsync()
|
||||
}
|
||||
|
||||
Scheduler.prototype.tickSync = function tickSync () {
|
||||
// Empty sync queue first
|
||||
var sync = this.sync
|
||||
var res = true
|
||||
this.sync = []
|
||||
for (var i = 0; i < sync.length; i++) {
|
||||
var item = sync[i]
|
||||
debug('tick sync pending=%d', this.count, item.chunks)
|
||||
for (var j = 0; j < item.chunks.length; j++) {
|
||||
this.count--
|
||||
// TODO: handle stream backoff properly
|
||||
try {
|
||||
res = this.push(item.chunks[j])
|
||||
} catch (err) {
|
||||
this.emit('error', err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
debug('after tick sync pending=%d', this.count)
|
||||
|
||||
// TODO(indutny): figure out the way to invoke callback on actual write
|
||||
if (item.callback) {
|
||||
item.callback(null)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Scheduler.prototype.tickAsync = function tickAsync () {
|
||||
var res = true
|
||||
var list = this.list
|
||||
if (list.length === 0) {
|
||||
return res
|
||||
}
|
||||
|
||||
var startPriority = list[0].priority
|
||||
for (var index = 0; list.length > 0; index++) {
|
||||
// Loop index
|
||||
index %= list.length
|
||||
if (startPriority - list[index].priority > this.window) { index = 0 }
|
||||
debug('tick async index=%d start=%d', index, startPriority)
|
||||
|
||||
var current = list[index]
|
||||
var item = current.shift()
|
||||
|
||||
if (current.isEmpty()) {
|
||||
list.splice(index, 1)
|
||||
if (index === 0 && list.length > 0) {
|
||||
startPriority = list[0].priority
|
||||
}
|
||||
index--
|
||||
}
|
||||
|
||||
debug('tick async pending=%d', this.count, item.chunks)
|
||||
for (var i = 0; i < item.chunks.length; i++) {
|
||||
this.count--
|
||||
// TODO: handle stream backoff properly
|
||||
try {
|
||||
res = this.push(item.chunks[i])
|
||||
} catch (err) {
|
||||
this.emit('error', err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
debug('after tick pending=%d', this.count)
|
||||
|
||||
// TODO(indutny): figure out the way to invoke callback on actual write
|
||||
if (item.callback) {
|
||||
item.callback(null)
|
||||
}
|
||||
if (!res) { break }
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
Scheduler.prototype.dump = function dump () {
|
||||
this.tickSync()
|
||||
|
||||
// Write everything out
|
||||
while (!this.tickAsync()) {
|
||||
// Intentional no-op
|
||||
}
|
||||
assert.strictEqual(this.count, 0)
|
||||
}
|
||||
|
||||
function SchedulerItem (stream, priority) {
|
||||
this.stream = stream
|
||||
this.priority = priority
|
||||
this.queue = []
|
||||
}
|
||||
|
||||
SchedulerItem.prototype.push = function push (chunks) {
|
||||
this.queue.push(chunks)
|
||||
}
|
||||
|
||||
SchedulerItem.prototype.shift = function shift () {
|
||||
return this.queue.shift()
|
||||
}
|
||||
|
||||
SchedulerItem.prototype.isEmpty = function isEmpty () {
|
||||
return this.queue.length === 0
|
||||
}
|
94
node_modules/spdy-transport/lib/spdy-transport/protocol/base/utils.js
generated
vendored
Normal file
94
node_modules/spdy-transport/lib/spdy-transport/protocol/base/utils.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
'use strict'
|
||||
|
||||
var utils = exports
|
||||
|
||||
var util = require('util')
|
||||
|
||||
function ProtocolError (code, message) {
|
||||
this.code = code
|
||||
this.message = message
|
||||
}
|
||||
util.inherits(ProtocolError, Error)
|
||||
utils.ProtocolError = ProtocolError
|
||||
|
||||
utils.error = function error (code, message) {
|
||||
return new ProtocolError(code, message)
|
||||
}
|
||||
|
||||
utils.reverse = function reverse (object) {
|
||||
var result = []
|
||||
|
||||
Object.keys(object).forEach(function (key) {
|
||||
result[object[key] | 0] = key
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// weight [1, 36] <=> priority [0, 7]
|
||||
// This way weight=16 is preserved and has priority=3
|
||||
utils.weightToPriority = function weightToPriority (weight) {
|
||||
return ((Math.min(35, (weight - 1)) / 35) * 7) | 0
|
||||
}
|
||||
|
||||
utils.priorityToWeight = function priorityToWeight (priority) {
|
||||
return (((priority / 7) * 35) | 0) + 1
|
||||
}
|
||||
|
||||
// Copy-Paste from node
|
||||
exports.addHeaderLine = function addHeaderLine (field, value, dest) {
|
||||
field = field.toLowerCase()
|
||||
if (/^:/.test(field)) {
|
||||
dest[field] = value
|
||||
return
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
// Array headers:
|
||||
case 'set-cookie':
|
||||
if (dest[field] !== undefined) {
|
||||
dest[field].push(value)
|
||||
} else {
|
||||
dest[field] = [ value ]
|
||||
}
|
||||
break
|
||||
|
||||
/* eslint-disable max-len */
|
||||
// list is taken from:
|
||||
/* eslint-enable max-len */
|
||||
case 'content-type':
|
||||
case 'content-length':
|
||||
case 'user-agent':
|
||||
case 'referer':
|
||||
case 'host':
|
||||
case 'authorization':
|
||||
case 'proxy-authorization':
|
||||
case 'if-modified-since':
|
||||
case 'if-unmodified-since':
|
||||
case 'from':
|
||||
case 'location':
|
||||
case 'max-forwards':
|
||||
// drop duplicates
|
||||
if (dest[field] === undefined) {
|
||||
dest[field] = value
|
||||
}
|
||||
break
|
||||
|
||||
case 'cookie':
|
||||
// make semicolon-separated list
|
||||
if (dest[field] !== undefined) {
|
||||
dest[field] += '; ' + value
|
||||
} else {
|
||||
dest[field] = value
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
// make comma-separated list
|
||||
if (dest[field] !== undefined) {
|
||||
dest[field] += ', ' + value
|
||||
} else {
|
||||
dest[field] = value
|
||||
}
|
||||
}
|
||||
}
|
93
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/constants.js
generated
vendored
Normal file
93
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/constants.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
'use strict'
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
var base = transport.protocol.base
|
||||
|
||||
exports.PREFACE_SIZE = 24
|
||||
exports.PREFACE = 'PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n'
|
||||
exports.PREFACE_BUFFER = Buffer.from(exports.PREFACE)
|
||||
|
||||
exports.PING_OPAQUE_SIZE = 8
|
||||
|
||||
exports.FRAME_HEADER_SIZE = 9
|
||||
exports.INITIAL_MAX_FRAME_SIZE = 16384
|
||||
exports.ABSOLUTE_MAX_FRAME_SIZE = 16777215
|
||||
exports.HEADER_TABLE_SIZE = 4096
|
||||
exports.DEFAULT_MAX_HEADER_LIST_SIZE = 80 * 1024 // as in http_parser
|
||||
exports.MAX_INITIAL_WINDOW_SIZE = 2147483647
|
||||
|
||||
exports.DEFAULT_WEIGHT = 16
|
||||
|
||||
exports.MAX_CONCURRENT_STREAMS = Infinity
|
||||
|
||||
exports.frameType = {
|
||||
DATA: 0,
|
||||
HEADERS: 1,
|
||||
PRIORITY: 2,
|
||||
RST_STREAM: 3,
|
||||
SETTINGS: 4,
|
||||
PUSH_PROMISE: 5,
|
||||
PING: 6,
|
||||
GOAWAY: 7,
|
||||
WINDOW_UPDATE: 8,
|
||||
CONTINUATION: 9,
|
||||
|
||||
// Custom
|
||||
X_FORWARDED_FOR: 0xde
|
||||
}
|
||||
|
||||
exports.flags = {
|
||||
ACK: 0x01, // SETTINGS-only
|
||||
END_STREAM: 0x01,
|
||||
END_HEADERS: 0x04,
|
||||
PADDED: 0x08,
|
||||
PRIORITY: 0x20
|
||||
}
|
||||
|
||||
exports.settings = {
|
||||
SETTINGS_HEADER_TABLE_SIZE: 0x01,
|
||||
SETTINGS_ENABLE_PUSH: 0x02,
|
||||
SETTINGS_MAX_CONCURRENT_STREAMS: 0x03,
|
||||
SETTINGS_INITIAL_WINDOW_SIZE: 0x04,
|
||||
SETTINGS_MAX_FRAME_SIZE: 0x05,
|
||||
SETTINGS_MAX_HEADER_LIST_SIZE: 0x06
|
||||
}
|
||||
|
||||
exports.settingsIndex = [
|
||||
null,
|
||||
'header_table_size',
|
||||
'enable_push',
|
||||
'max_concurrent_streams',
|
||||
'initial_window_size',
|
||||
'max_frame_size',
|
||||
'max_header_list_size'
|
||||
]
|
||||
|
||||
exports.error = {
|
||||
OK: 0,
|
||||
NO_ERROR: 0,
|
||||
|
||||
PROTOCOL_ERROR: 1,
|
||||
INTERNAL_ERROR: 2,
|
||||
FLOW_CONTROL_ERROR: 3,
|
||||
SETTINGS_TIMEOUT: 4,
|
||||
|
||||
STREAM_CLOSED: 5,
|
||||
INVALID_STREAM: 5,
|
||||
|
||||
FRAME_SIZE_ERROR: 6,
|
||||
REFUSED_STREAM: 7,
|
||||
CANCEL: 8,
|
||||
COMPRESSION_ERROR: 9,
|
||||
CONNECT_ERROR: 10,
|
||||
ENHANCE_YOUR_CALM: 11,
|
||||
INADEQUATE_SECURITY: 12,
|
||||
HTTP_1_1_REQUIRED: 13
|
||||
}
|
||||
exports.errorByCode = base.utils.reverse(exports.error)
|
||||
|
||||
exports.DEFAULT_WINDOW = 64 * 1024 - 1
|
||||
|
||||
exports.goaway = exports.error
|
||||
exports.goawayByCode = Object.assign({}, exports.errorByCode)
|
||||
exports.goawayByCode[0] = 'OK'
|
542
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/framer.js
generated
vendored
Normal file
542
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/framer.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
34
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/hpack-pool.js
generated
vendored
Normal file
34
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/hpack-pool.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict'
|
||||
|
||||
var constants = require('./').constants
|
||||
|
||||
var hpack = require('hpack.js')
|
||||
|
||||
function Pool () {
|
||||
}
|
||||
module.exports = Pool
|
||||
|
||||
Pool.create = function create () {
|
||||
return new Pool()
|
||||
}
|
||||
|
||||
Pool.prototype.get = function get (version) {
|
||||
var options = {
|
||||
table: {
|
||||
maxSize: constants.HEADER_TABLE_SIZE
|
||||
}
|
||||
}
|
||||
|
||||
var compress = hpack.compressor.create(options)
|
||||
var decompress = hpack.decompressor.create(options)
|
||||
|
||||
return {
|
||||
version: version,
|
||||
|
||||
compress: compress,
|
||||
decompress: decompress
|
||||
}
|
||||
}
|
||||
|
||||
Pool.prototype.put = function put () {
|
||||
}
|
8
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/index.js
generated
vendored
Normal file
8
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
exports.name = 'h2'
|
||||
|
||||
exports.constants = require('./constants')
|
||||
exports.parser = require('./parser')
|
||||
exports.framer = require('./framer')
|
||||
exports.compressionPool = require('./hpack-pool')
|
578
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js
generated
vendored
Normal file
578
node_modules/spdy-transport/lib/spdy-transport/protocol/http2/parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
146
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/constants.js
generated
vendored
Normal file
146
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/constants.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
'use strict'
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
var base = transport.protocol.base
|
||||
|
||||
exports.FRAME_HEADER_SIZE = 8
|
||||
|
||||
exports.PING_OPAQUE_SIZE = 4
|
||||
|
||||
exports.MAX_CONCURRENT_STREAMS = Infinity
|
||||
exports.DEFAULT_MAX_HEADER_LIST_SIZE = Infinity
|
||||
|
||||
exports.DEFAULT_WEIGHT = 16
|
||||
|
||||
exports.frameType = {
|
||||
SYN_STREAM: 1,
|
||||
SYN_REPLY: 2,
|
||||
RST_STREAM: 3,
|
||||
SETTINGS: 4,
|
||||
PING: 6,
|
||||
GOAWAY: 7,
|
||||
HEADERS: 8,
|
||||
WINDOW_UPDATE: 9,
|
||||
|
||||
// Custom
|
||||
X_FORWARDED_FOR: 0xf000
|
||||
}
|
||||
|
||||
exports.flags = {
|
||||
FLAG_FIN: 0x01,
|
||||
FLAG_COMPRESSED: 0x02,
|
||||
FLAG_UNIDIRECTIONAL: 0x02
|
||||
}
|
||||
|
||||
exports.error = {
|
||||
PROTOCOL_ERROR: 1,
|
||||
INVALID_STREAM: 2,
|
||||
REFUSED_STREAM: 3,
|
||||
UNSUPPORTED_VERSION: 4,
|
||||
CANCEL: 5,
|
||||
INTERNAL_ERROR: 6,
|
||||
FLOW_CONTROL_ERROR: 7,
|
||||
STREAM_IN_USE: 8,
|
||||
// STREAM_ALREADY_CLOSED: 9
|
||||
STREAM_CLOSED: 9,
|
||||
INVALID_CREDENTIALS: 10,
|
||||
FRAME_TOO_LARGE: 11
|
||||
}
|
||||
exports.errorByCode = base.utils.reverse(exports.error)
|
||||
|
||||
exports.settings = {
|
||||
FLAG_SETTINGS_PERSIST_VALUE: 1,
|
||||
FLAG_SETTINGS_PERSISTED: 2,
|
||||
|
||||
SETTINGS_UPLOAD_BANDWIDTH: 1,
|
||||
SETTINGS_DOWNLOAD_BANDWIDTH: 2,
|
||||
SETTINGS_ROUND_TRIP_TIME: 3,
|
||||
SETTINGS_MAX_CONCURRENT_STREAMS: 4,
|
||||
SETTINGS_CURRENT_CWND: 5,
|
||||
SETTINGS_DOWNLOAD_RETRANS_RATE: 6,
|
||||
SETTINGS_INITIAL_WINDOW_SIZE: 7,
|
||||
SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE: 8
|
||||
}
|
||||
|
||||
exports.settingsIndex = [
|
||||
null,
|
||||
|
||||
'upload_bandwidth',
|
||||
'download_bandwidth',
|
||||
'round_trip_time',
|
||||
'max_concurrent_streams',
|
||||
'current_cwnd',
|
||||
'download_retrans_rate',
|
||||
'initial_window_size',
|
||||
'client_certificate_vector_size'
|
||||
]
|
||||
|
||||
exports.DEFAULT_WINDOW = 64 * 1024
|
||||
exports.MAX_INITIAL_WINDOW_SIZE = 2147483647
|
||||
|
||||
exports.goaway = {
|
||||
OK: 0,
|
||||
PROTOCOL_ERROR: 1,
|
||||
INTERNAL_ERROR: 2
|
||||
}
|
||||
exports.goawayByCode = base.utils.reverse(exports.goaway)
|
||||
|
||||
exports.statusReason = {
|
||||
100: 'Continue',
|
||||
101: 'Switching Protocols',
|
||||
102: 'Processing', // RFC 2518, obsoleted by RFC 4918
|
||||
200: 'OK',
|
||||
201: 'Created',
|
||||
202: 'Accepted',
|
||||
203: 'Non-Authoritative Information',
|
||||
204: 'No Content',
|
||||
205: 'Reset Content',
|
||||
206: 'Partial Content',
|
||||
207: 'Multi-Status', // RFC 4918
|
||||
300: 'Multiple Choices',
|
||||
301: 'Moved Permanently',
|
||||
302: 'Moved Temporarily',
|
||||
303: 'See Other',
|
||||
304: 'Not Modified',
|
||||
305: 'Use Proxy',
|
||||
307: 'Temporary Redirect',
|
||||
308: 'Permanent Redirect', // RFC 7238
|
||||
400: 'Bad Request',
|
||||
401: 'Unauthorized',
|
||||
402: 'Payment Required',
|
||||
403: 'Forbidden',
|
||||
404: 'Not Found',
|
||||
405: 'Method Not Allowed',
|
||||
406: 'Not Acceptable',
|
||||
407: 'Proxy Authentication Required',
|
||||
408: 'Request Time-out',
|
||||
409: 'Conflict',
|
||||
410: 'Gone',
|
||||
411: 'Length Required',
|
||||
412: 'Precondition Failed',
|
||||
413: 'Request Entity Too Large',
|
||||
414: 'Request-URI Too Large',
|
||||
415: 'Unsupported Media Type',
|
||||
416: 'Requested Range Not Satisfiable',
|
||||
417: 'Expectation Failed',
|
||||
418: 'I\'m a teapot', // RFC 2324
|
||||
422: 'Unprocessable Entity', // RFC 4918
|
||||
423: 'Locked', // RFC 4918
|
||||
424: 'Failed Dependency', // RFC 4918
|
||||
425: 'Unordered Collection', // RFC 4918
|
||||
426: 'Upgrade Required', // RFC 2817
|
||||
428: 'Precondition Required', // RFC 6585
|
||||
429: 'Too Many Requests', // RFC 6585
|
||||
431: 'Request Header Fields Too Large', // RFC 6585
|
||||
500: 'Internal Server Error',
|
||||
501: 'Not Implemented',
|
||||
502: 'Bad Gateway',
|
||||
503: 'Service Unavailable',
|
||||
504: 'Gateway Time-out',
|
||||
505: 'HTTP Version Not Supported',
|
||||
506: 'Variant Also Negotiates', // RFC 2295
|
||||
507: 'Insufficient Storage', // RFC 4918
|
||||
509: 'Bandwidth Limit Exceeded',
|
||||
510: 'Not Extended', // RFC 2774
|
||||
511: 'Network Authentication Required' // RFC 6585
|
||||
}
|
203
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/dictionary.js
generated
vendored
Normal file
203
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/dictionary.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
'use strict'
|
||||
|
||||
var dictionary = {}
|
||||
module.exports = dictionary
|
||||
|
||||
dictionary[2] = Buffer.from([
|
||||
'optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-',
|
||||
'languageauthorizationexpectfromhostif-modified-sinceif-matchif-none-matchi',
|
||||
'f-rangeif-unmodifiedsincemax-forwardsproxy-authorizationrangerefererteuser',
|
||||
'-agent10010120020120220320420520630030130230330430530630740040140240340440',
|
||||
'5406407408409410411412413414415416417500501502503504505accept-rangesageeta',
|
||||
'glocationproxy-authenticatepublicretry-afterservervarywarningwww-authentic',
|
||||
'ateallowcontent-basecontent-encodingcache-controlconnectiondatetrailertran',
|
||||
'sfer-encodingupgradeviawarningcontent-languagecontent-lengthcontent-locati',
|
||||
'oncontent-md5content-rangecontent-typeetagexpireslast-modifiedset-cookieMo',
|
||||
'ndayTuesdayWednesdayThursdayFridaySaturdaySundayJanFebMarAprMayJunJulAugSe',
|
||||
'pOctNovDecchunkedtext/htmlimage/pngimage/jpgimage/gifapplication/xmlapplic',
|
||||
'ation/xhtmltext/plainpublicmax-agecharset=iso-8859-1utf-8gzipdeflateHTTP/1',
|
||||
'.1statusversionurl\x00'
|
||||
].join(''))
|
||||
|
||||
dictionary[3] = Buffer.from([
|
||||
0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // ....opti
|
||||
0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // ons....h
|
||||
0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // ead....p
|
||||
0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // ost....p
|
||||
0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // ut....de
|
||||
0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // lete....
|
||||
0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // trace...
|
||||
0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // .accept.
|
||||
0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep
|
||||
0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // t-charse
|
||||
0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, // t....acc
|
||||
0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ept-enco
|
||||
0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, // ding....
|
||||
0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, // accept-l
|
||||
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, // anguage.
|
||||
0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep
|
||||
0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, // t-ranges
|
||||
0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, // ....age.
|
||||
0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, // ...allow
|
||||
0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, // ....auth
|
||||
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, // orizatio
|
||||
0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, // n....cac
|
||||
0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, // he-contr
|
||||
0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, // ol....co
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // nnection
|
||||
0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, // ....cont
|
||||
0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, // ent-base
|
||||
0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, // ....cont
|
||||
0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ent-enco
|
||||
0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, // ding....
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, // content-
|
||||
0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, // language
|
||||
0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, // ....cont
|
||||
0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, // ent-leng
|
||||
0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, // th....co
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, // ntent-lo
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // cation..
|
||||
0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten
|
||||
0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, // t-md5...
|
||||
0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, // .content
|
||||
0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, // -range..
|
||||
0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten
|
||||
0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // t-type..
|
||||
0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, // ..date..
|
||||
0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, // ..etag..
|
||||
0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, // ..expect
|
||||
0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, // ....expi
|
||||
0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, // res....f
|
||||
0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, // rom....h
|
||||
0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, // ost....i
|
||||
0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, // f-match.
|
||||
0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, // ...if-mo
|
||||
0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, // dified-s
|
||||
0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, // ince....
|
||||
0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, // if-none-
|
||||
0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, // match...
|
||||
0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, // .if-rang
|
||||
0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, // e....if-
|
||||
0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, // unmodifi
|
||||
0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, // ed-since
|
||||
0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, // ....last
|
||||
0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, // -modifie
|
||||
0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, // d....loc
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, // ation...
|
||||
0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, // .max-for
|
||||
0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, // wards...
|
||||
0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, // .pragma.
|
||||
0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, // ...proxy
|
||||
0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, // -authent
|
||||
0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, // icate...
|
||||
0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, // .proxy-a
|
||||
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, // uthoriza
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, // tion....
|
||||
0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, // range...
|
||||
0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, // .referer
|
||||
0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, // ....retr
|
||||
0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, // y-after.
|
||||
0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, // ...serve
|
||||
0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, // r....te.
|
||||
0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, // ...trail
|
||||
0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, // er....tr
|
||||
0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, // ansfer-e
|
||||
0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, // ncoding.
|
||||
0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, // ...upgra
|
||||
0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, // de....us
|
||||
0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, // er-agent
|
||||
0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, // ....vary
|
||||
0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, // ....via.
|
||||
0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, // ...warni
|
||||
0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, // ng....ww
|
||||
0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, // w-authen
|
||||
0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, // ticate..
|
||||
0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, // ..method
|
||||
0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, // ....get.
|
||||
0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, // ...statu
|
||||
0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, // s....200
|
||||
0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, // .OK....v
|
||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ersion..
|
||||
0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, // ..HTTP.1
|
||||
0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, // .1....ur
|
||||
0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, // l....pub
|
||||
0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, // lic....s
|
||||
0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, // et-cooki
|
||||
0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, // e....kee
|
||||
0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, // p-alive.
|
||||
0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, // ...origi
|
||||
0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, // n1001012
|
||||
0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, // 01202205
|
||||
0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, // 20630030
|
||||
0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, // 23033043
|
||||
0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, // 05306307
|
||||
0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, // 40240540
|
||||
0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, // 64074084
|
||||
0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, // 09410411
|
||||
0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, // 41241341
|
||||
0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, // 44154164
|
||||
0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, // 17502504
|
||||
0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, // 505203.N
|
||||
0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, // on-Autho
|
||||
0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, // ritative
|
||||
0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, // .Informa
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, // tion204.
|
||||
0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, // No.Conte
|
||||
0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, // nt301.Mo
|
||||
0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, // ved.Perm
|
||||
0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, // anently4
|
||||
0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, // 00.Bad.R
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, // equest40
|
||||
0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, // 1.Unauth
|
||||
0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, // orized40
|
||||
0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, // 3.Forbid
|
||||
0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, // den404.N
|
||||
0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, // ot.Found
|
||||
0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, // 500.Inte
|
||||
0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, // rnal.Ser
|
||||
0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, // ver.Erro
|
||||
0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, // r501.Not
|
||||
0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, // .Impleme
|
||||
0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, // nted503.
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, // Service.
|
||||
0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, // Unavaila
|
||||
0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, // bleJan.F
|
||||
0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, // eb.Mar.A
|
||||
0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, // pr.May.J
|
||||
0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, // un.Jul.A
|
||||
0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, // ug.Sept.
|
||||
0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, // Oct.Nov.
|
||||
0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, // Dec.00.0
|
||||
0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, // 0.00.Mon
|
||||
0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, // ..Tue..W
|
||||
0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, // ed..Thu.
|
||||
0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, // .Fri..Sa
|
||||
0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, // t..Sun..
|
||||
0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, // GMTchunk
|
||||
0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, // ed.text.
|
||||
0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, // html.ima
|
||||
0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, // ge.png.i
|
||||
0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, // mage.jpg
|
||||
0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, // .image.g
|
||||
0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // if.appli
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x
|
||||
0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // ml.appli
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x
|
||||
0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, // html.xml
|
||||
0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, // .text.pl
|
||||
0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, // ain.text
|
||||
0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, // .javascr
|
||||
0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, // ipt.publ
|
||||
0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, // icprivat
|
||||
0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, // emax-age
|
||||
0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, // .gzip.de
|
||||
0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, // flate.sd
|
||||
0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // chcharse
|
||||
0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, // t.utf-8c
|
||||
0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, // harset.i
|
||||
0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, // so-8859-
|
||||
0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, // 1.utf-..
|
||||
0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e // .enq.0.
|
||||
])
|
||||
|
||||
dictionary[3.1] = dictionary[3]
|
519
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/framer.js
generated
vendored
Normal file
519
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/framer.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/index.js
generated
vendored
Normal file
9
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
exports.name = 'spdy'
|
||||
|
||||
exports.dictionary = require('./dictionary')
|
||||
exports.constants = require('./constants')
|
||||
exports.parser = require('./parser')
|
||||
exports.framer = require('./framer')
|
||||
exports.compressionPool = require('./zlib-pool')
|
485
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/parser.js
generated
vendored
Normal file
485
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/parser.js
generated
vendored
Normal file
@@ -0,0 +1,485 @@
|
||||
'use strict'
|
||||
|
||||
var parser = exports
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
var base = transport.protocol.base
|
||||
var utils = base.utils
|
||||
var constants = require('./constants')
|
||||
|
||||
var assert = require('assert')
|
||||
var util = require('util')
|
||||
var OffsetBuffer = require('obuf')
|
||||
|
||||
function Parser (options) {
|
||||
base.Parser.call(this, options)
|
||||
|
||||
this.isServer = options.isServer
|
||||
this.waiting = constants.FRAME_HEADER_SIZE
|
||||
this.state = 'frame-head'
|
||||
this.pendingHeader = null
|
||||
}
|
||||
util.inherits(Parser, base.Parser)
|
||||
|
||||
parser.create = function create (options) {
|
||||
return new Parser(options)
|
||||
}
|
||||
|
||||
Parser.prototype.setMaxFrameSize = function setMaxFrameSize (size) {
|
||||
// http2-only
|
||||
}
|
||||
|
||||
Parser.prototype.setMaxHeaderListSize = function setMaxHeaderListSize (size) {
|
||||
// http2-only
|
||||
}
|
||||
|
||||
// Only for testing
|
||||
Parser.prototype.skipPreface = function skipPreface () {
|
||||
}
|
||||
|
||||
Parser.prototype.execute = function execute (buffer, callback) {
|
||||
if (this.state === 'frame-head') { return this.onFrameHead(buffer, callback) }
|
||||
|
||||
assert(this.state === 'frame-body' && this.pendingHeader !== null)
|
||||
|
||||
var self = this
|
||||
var header = this.pendingHeader
|
||||
this.pendingHeader = null
|
||||
|
||||
this.onFrameBody(header, buffer, function (err, frame) {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
self.state = 'frame-head'
|
||||
self.waiting = constants.FRAME_HEADER_SIZE
|
||||
self.partial = false
|
||||
callback(null, frame)
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.executePartial = function executePartial (buffer, callback) {
|
||||
var header = this.pendingHeader
|
||||
|
||||
if (this.window) {
|
||||
this.window.recv.update(-buffer.size)
|
||||
}
|
||||
|
||||
// DATA frame
|
||||
callback(null, {
|
||||
type: 'DATA',
|
||||
id: header.id,
|
||||
|
||||
// Partial DATA can't be FIN
|
||||
fin: false,
|
||||
data: buffer.take(buffer.size)
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.onFrameHead = function onFrameHead (buffer, callback) {
|
||||
var header = {
|
||||
control: (buffer.peekUInt8() & 0x80) === 0x80,
|
||||
version: null,
|
||||
type: null,
|
||||
id: null,
|
||||
flags: null,
|
||||
length: null
|
||||
}
|
||||
|
||||
if (header.control) {
|
||||
header.version = buffer.readUInt16BE() & 0x7fff
|
||||
header.type = buffer.readUInt16BE()
|
||||
} else {
|
||||
header.id = buffer.readUInt32BE(0) & 0x7fffffff
|
||||
}
|
||||
header.flags = buffer.readUInt8()
|
||||
header.length = buffer.readUInt24BE()
|
||||
|
||||
if (this.version === null && header.control) {
|
||||
// TODO(indutny): do ProtocolError here and in the rest of errors
|
||||
if (header.version !== 2 && header.version !== 3) {
|
||||
return callback(new Error('Unsupported SPDY version: ' + header.version))
|
||||
}
|
||||
this.setVersion(header.version)
|
||||
}
|
||||
|
||||
this.state = 'frame-body'
|
||||
this.waiting = header.length
|
||||
this.pendingHeader = header
|
||||
this.partial = !header.control
|
||||
|
||||
callback(null, null)
|
||||
}
|
||||
|
||||
Parser.prototype.onFrameBody = function onFrameBody (header, buffer, callback) {
|
||||
// Data frame
|
||||
if (!header.control) {
|
||||
// Count received bytes
|
||||
if (this.window) {
|
||||
this.window.recv.update(-buffer.size)
|
||||
}
|
||||
|
||||
// No support for compressed DATA
|
||||
if ((header.flags & constants.flags.FLAG_COMPRESSED) !== 0) {
|
||||
return callback(new Error('DATA compression not supported'))
|
||||
}
|
||||
|
||||
if (header.id === 0) {
|
||||
return callback(this.error(constants.error.PROTOCOL_ERROR,
|
||||
'Invalid stream id for DATA'))
|
||||
}
|
||||
|
||||
return callback(null, {
|
||||
type: 'DATA',
|
||||
id: header.id,
|
||||
fin: (header.flags & constants.flags.FLAG_FIN) !== 0,
|
||||
data: buffer.take(buffer.size)
|
||||
})
|
||||
}
|
||||
|
||||
if (header.type === 0x01 || header.type === 0x02) { // SYN_STREAM or SYN_REPLY
|
||||
this.onSynHeadFrame(header.type, header.flags, buffer, callback)
|
||||
} else if (header.type === 0x03) { // RST_STREAM
|
||||
this.onRSTFrame(buffer, callback)
|
||||
} else if (header.type === 0x04) { // SETTINGS
|
||||
this.onSettingsFrame(buffer, callback)
|
||||
} else if (header.type === 0x05) {
|
||||
callback(null, { type: 'NOOP' })
|
||||
} else if (header.type === 0x06) { // PING
|
||||
this.onPingFrame(buffer, callback)
|
||||
} else if (header.type === 0x07) { // GOAWAY
|
||||
this.onGoawayFrame(buffer, callback)
|
||||
} else if (header.type === 0x08) { // HEADERS
|
||||
this.onHeaderFrames(buffer, callback)
|
||||
} else if (header.type === 0x09) { // WINDOW_UPDATE
|
||||
this.onWindowUpdateFrame(buffer, callback)
|
||||
} else if (header.type === 0xf000) { // X-FORWARDED
|
||||
this.onXForwardedFrame(buffer, callback)
|
||||
} else {
|
||||
callback(null, { type: 'unknown: ' + header.type })
|
||||
}
|
||||
}
|
||||
|
||||
Parser.prototype._filterHeader = function _filterHeader (headers, name) {
|
||||
var res = {}
|
||||
var keys = Object.keys(headers)
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i]
|
||||
if (key !== name) {
|
||||
res[key] = headers[key]
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
Parser.prototype.onSynHeadFrame = function onSynHeadFrame (type,
|
||||
flags,
|
||||
body,
|
||||
callback) {
|
||||
var self = this
|
||||
var stream = type === 0x01
|
||||
var offset = stream ? 10 : this.version === 2 ? 6 : 4
|
||||
|
||||
if (!body.has(offset)) {
|
||||
return callback(new Error('SynHead OOB'))
|
||||
}
|
||||
|
||||
var head = body.clone(offset)
|
||||
body.skip(offset)
|
||||
this.parseKVs(body, function (err, headers) {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
if (stream &&
|
||||
(!headers[':method'] || !headers[':path'])) {
|
||||
return callback(new Error('Missing `:method` and/or `:path` header'))
|
||||
}
|
||||
|
||||
var id = head.readUInt32BE() & 0x7fffffff
|
||||
|
||||
if (id === 0) {
|
||||
return callback(self.error(constants.error.PROTOCOL_ERROR,
|
||||
'Invalid stream id for HEADERS'))
|
||||
}
|
||||
|
||||
var associated = stream ? head.readUInt32BE() & 0x7fffffff : 0
|
||||
var priority = stream
|
||||
? head.readUInt8() >> 5
|
||||
: utils.weightToPriority(constants.DEFAULT_WEIGHT)
|
||||
var fin = (flags & constants.flags.FLAG_FIN) !== 0
|
||||
var unidir = (flags & constants.flags.FLAG_UNIDIRECTIONAL) !== 0
|
||||
var path = headers[':path']
|
||||
|
||||
var isPush = stream && associated !== 0
|
||||
|
||||
var weight = utils.priorityToWeight(priority)
|
||||
var priorityInfo = {
|
||||
weight: weight,
|
||||
exclusive: false,
|
||||
parent: 0
|
||||
}
|
||||
|
||||
if (!isPush) {
|
||||
callback(null, {
|
||||
type: 'HEADERS',
|
||||
id: id,
|
||||
priority: priorityInfo,
|
||||
fin: fin,
|
||||
writable: !unidir,
|
||||
headers: headers,
|
||||
path: path
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (stream && !headers[':status']) {
|
||||
return callback(new Error('Missing `:status` header'))
|
||||
}
|
||||
|
||||
var filteredHeaders = self._filterHeader(headers, ':status')
|
||||
|
||||
callback(null, [ {
|
||||
type: 'PUSH_PROMISE',
|
||||
id: associated,
|
||||
fin: false,
|
||||
promisedId: id,
|
||||
headers: filteredHeaders,
|
||||
path: path
|
||||
}, {
|
||||
type: 'HEADERS',
|
||||
id: id,
|
||||
fin: fin,
|
||||
priority: priorityInfo,
|
||||
writable: true,
|
||||
path: undefined,
|
||||
headers: {
|
||||
':status': headers[':status']
|
||||
}
|
||||
}])
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.onHeaderFrames = function onHeaderFrames (body, callback) {
|
||||
var offset = this.version === 2 ? 6 : 4
|
||||
if (!body.has(offset)) {
|
||||
return callback(new Error('HEADERS OOB'))
|
||||
}
|
||||
|
||||
var streamId = body.readUInt32BE() & 0x7fffffff
|
||||
if (this.version === 2) { body.skip(2) }
|
||||
|
||||
this.parseKVs(body, function (err, headers) {
|
||||
if (err) { return callback(err) }
|
||||
|
||||
callback(null, {
|
||||
type: 'HEADERS',
|
||||
priority: {
|
||||
parent: 0,
|
||||
exclusive: false,
|
||||
weight: constants.DEFAULT_WEIGHT
|
||||
},
|
||||
id: streamId,
|
||||
fin: false,
|
||||
writable: true,
|
||||
path: undefined,
|
||||
headers: headers
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.parseKVs = function parseKVs (buffer, callback) {
|
||||
var self = this
|
||||
|
||||
this.decompress.write(buffer.toChunks(), function (err, chunks) {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
var buffer = new OffsetBuffer()
|
||||
for (var i = 0; i < chunks.length; i++) {
|
||||
buffer.push(chunks[i])
|
||||
}
|
||||
|
||||
var size = self.version === 2 ? 2 : 4
|
||||
if (!buffer.has(size)) { return callback(new Error('KV OOB')) }
|
||||
|
||||
var count = self.version === 2
|
||||
? buffer.readUInt16BE()
|
||||
: buffer.readUInt32BE()
|
||||
|
||||
var headers = {}
|
||||
|
||||
function readString () {
|
||||
if (!buffer.has(size)) { return null }
|
||||
var len = self.version === 2
|
||||
? buffer.readUInt16BE()
|
||||
: buffer.readUInt32BE()
|
||||
|
||||
if (!buffer.has(len)) { return null }
|
||||
|
||||
var value = buffer.take(len)
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
while (count > 0) {
|
||||
var key = readString()
|
||||
var value = readString()
|
||||
|
||||
if (key === null || value === null) {
|
||||
return callback(new Error('Headers OOB'))
|
||||
}
|
||||
|
||||
if (self.version < 3) {
|
||||
var isInternal = /^(method|version|url|host|scheme|status)$/.test(key)
|
||||
if (key === 'url') {
|
||||
key = 'path'
|
||||
}
|
||||
if (isInternal) {
|
||||
key = ':' + key
|
||||
}
|
||||
}
|
||||
|
||||
// Compatibility with HTTP2
|
||||
if (key === ':status') {
|
||||
value = value.split(/ /g, 2)[0]
|
||||
}
|
||||
|
||||
count--
|
||||
if (key === ':host') {
|
||||
key = ':authority'
|
||||
}
|
||||
|
||||
// Skip version, not present in HTTP2
|
||||
if (key === ':version') {
|
||||
continue
|
||||
}
|
||||
|
||||
value = value.split(/\0/g)
|
||||
for (var j = 0; j < value.length; j++) {
|
||||
utils.addHeaderLine(key, value[j], headers)
|
||||
}
|
||||
}
|
||||
|
||||
callback(null, headers)
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.onRSTFrame = function onRSTFrame (body, callback) {
|
||||
if (!body.has(8)) { return callback(new Error('RST OOB')) }
|
||||
|
||||
var frame = {
|
||||
type: 'RST',
|
||||
id: body.readUInt32BE() & 0x7fffffff,
|
||||
code: constants.errorByCode[body.readUInt32BE()]
|
||||
}
|
||||
|
||||
if (frame.id === 0) {
|
||||
return callback(this.error(constants.error.PROTOCOL_ERROR,
|
||||
'Invalid stream id for RST'))
|
||||
}
|
||||
|
||||
if (body.size !== 0) {
|
||||
frame.extra = body.take(body.size)
|
||||
}
|
||||
callback(null, frame)
|
||||
}
|
||||
|
||||
Parser.prototype.onSettingsFrame = function onSettingsFrame (body, callback) {
|
||||
if (!body.has(4)) {
|
||||
return callback(new Error('SETTINGS OOB'))
|
||||
}
|
||||
|
||||
var settings = {}
|
||||
var number = body.readUInt32BE()
|
||||
var idMap = {
|
||||
1: 'upload_bandwidth',
|
||||
2: 'download_bandwidth',
|
||||
3: 'round_trip_time',
|
||||
4: 'max_concurrent_streams',
|
||||
5: 'current_cwnd',
|
||||
6: 'download_retrans_rate',
|
||||
7: 'initial_window_size',
|
||||
8: 'client_certificate_vector_size'
|
||||
}
|
||||
|
||||
if (!body.has(number * 8)) {
|
||||
return callback(new Error('SETTINGS OOB#2'))
|
||||
}
|
||||
|
||||
for (var i = 0; i < number; i++) {
|
||||
var id = this.version === 2
|
||||
? body.readUInt32LE()
|
||||
: body.readUInt32BE()
|
||||
|
||||
var flags = (id >> 24) & 0xff
|
||||
id = id & 0xffffff
|
||||
|
||||
// Skip persisted settings
|
||||
if (flags & 0x2) { continue }
|
||||
|
||||
var name = idMap[id]
|
||||
|
||||
settings[name] = body.readUInt32BE()
|
||||
}
|
||||
|
||||
callback(null, {
|
||||
type: 'SETTINGS',
|
||||
settings: settings
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.onPingFrame = function onPingFrame (body, callback) {
|
||||
if (!body.has(4)) {
|
||||
return callback(new Error('PING OOB'))
|
||||
}
|
||||
|
||||
var isServer = this.isServer
|
||||
var opaque = body.clone(body.size).take(body.size)
|
||||
var id = body.readUInt32BE()
|
||||
var ack = isServer ? (id % 2 === 0) : (id % 2 === 1)
|
||||
|
||||
callback(null, { type: 'PING', opaque: opaque, ack: ack })
|
||||
}
|
||||
|
||||
Parser.prototype.onGoawayFrame = function onGoawayFrame (body, callback) {
|
||||
if (!body.has(8)) {
|
||||
return callback(new Error('GOAWAY OOB'))
|
||||
}
|
||||
|
||||
callback(null, {
|
||||
type: 'GOAWAY',
|
||||
lastId: body.readUInt32BE() & 0x7fffffff,
|
||||
code: constants.goawayByCode[body.readUInt32BE()]
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.onWindowUpdateFrame = function onWindowUpdateFrame (body,
|
||||
callback) {
|
||||
if (!body.has(8)) {
|
||||
return callback(new Error('WINDOW_UPDATE OOB'))
|
||||
}
|
||||
|
||||
callback(null, {
|
||||
type: 'WINDOW_UPDATE',
|
||||
id: body.readUInt32BE() & 0x7fffffff,
|
||||
delta: body.readInt32BE()
|
||||
})
|
||||
}
|
||||
|
||||
Parser.prototype.onXForwardedFrame = function onXForwardedFrame (body,
|
||||
callback) {
|
||||
if (!body.has(4)) {
|
||||
return callback(new Error('X_FORWARDED OOB'))
|
||||
}
|
||||
|
||||
var len = body.readUInt32BE()
|
||||
if (!body.has(len)) { return callback(new Error('X_FORWARDED host length OOB')) }
|
||||
|
||||
callback(null, {
|
||||
type: 'X_FORWARDED_FOR',
|
||||
host: body.take(len).toString()
|
||||
})
|
||||
}
|
65
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/zlib-pool.js
generated
vendored
Normal file
65
node_modules/spdy-transport/lib/spdy-transport/protocol/spdy/zlib-pool.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
var zlibpool = exports
|
||||
var zlib = require('zlib')
|
||||
|
||||
var transport = require('../../../spdy-transport')
|
||||
|
||||
// TODO(indutny): think about it, why has it always been Z_SYNC_FLUSH here.
|
||||
// It should be possible to manually flush stuff after the write instead
|
||||
function createDeflate (version, compression) {
|
||||
var deflate = zlib.createDeflate({
|
||||
dictionary: transport.protocol.spdy.dictionary[version],
|
||||
flush: zlib.Z_SYNC_FLUSH,
|
||||
windowBits: 11,
|
||||
level: compression ? zlib.Z_DEFAULT_COMPRESSION : zlib.Z_NO_COMPRESSION
|
||||
})
|
||||
|
||||
// For node.js v0.8
|
||||
deflate._flush = zlib.Z_SYNC_FLUSH
|
||||
|
||||
return deflate
|
||||
}
|
||||
|
||||
function createInflate (version) {
|
||||
var inflate = zlib.createInflate({
|
||||
dictionary: transport.protocol.spdy.dictionary[version],
|
||||
flush: zlib.Z_SYNC_FLUSH
|
||||
})
|
||||
|
||||
// For node.js v0.8
|
||||
inflate._flush = zlib.Z_SYNC_FLUSH
|
||||
|
||||
return inflate
|
||||
}
|
||||
|
||||
function Pool (compression) {
|
||||
this.compression = compression
|
||||
this.pool = {
|
||||
2: [],
|
||||
3: [],
|
||||
3.1: []
|
||||
}
|
||||
}
|
||||
|
||||
zlibpool.create = function create (compression) {
|
||||
return new Pool(compression)
|
||||
}
|
||||
|
||||
Pool.prototype.get = function get (version) {
|
||||
if (this.pool[version].length > 0) {
|
||||
return this.pool[version].pop()
|
||||
} else {
|
||||
var id = version
|
||||
|
||||
return {
|
||||
version: version,
|
||||
compress: createDeflate(id, this.compression),
|
||||
decompress: createInflate(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pool.prototype.put = function put (pair) {
|
||||
this.pool[pair.version].push(pair)
|
||||
}
|
710
node_modules/spdy-transport/lib/spdy-transport/stream.js
generated
vendored
Normal file
710
node_modules/spdy-transport/lib/spdy-transport/stream.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
196
node_modules/spdy-transport/lib/spdy-transport/utils.js
generated
vendored
Normal file
196
node_modules/spdy-transport/lib/spdy-transport/utils.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
var isNode = require('detect-node')
|
||||
|
||||
// Node.js 0.8, 0.10 and 0.12 support
|
||||
Object.assign = (process.versions.modules >= 46 || !isNode)
|
||||
? Object.assign // eslint-disable-next-line
|
||||
: util._extend
|
||||
|
||||
function QueueItem () {
|
||||
this.prev = null
|
||||
this.next = null
|
||||
}
|
||||
exports.QueueItem = QueueItem
|
||||
|
||||
function Queue () {
|
||||
QueueItem.call(this)
|
||||
|
||||
this.prev = this
|
||||
this.next = this
|
||||
}
|
||||
util.inherits(Queue, QueueItem)
|
||||
exports.Queue = Queue
|
||||
|
||||
Queue.prototype.insertTail = function insertTail (item) {
|
||||
item.prev = this.prev
|
||||
item.next = this
|
||||
item.prev.next = item
|
||||
item.next.prev = item
|
||||
}
|
||||
|
||||
Queue.prototype.remove = function remove (item) {
|
||||
var next = item.next
|
||||
var prev = item.prev
|
||||
|
||||
item.next = item
|
||||
item.prev = item
|
||||
next.prev = prev
|
||||
prev.next = next
|
||||
}
|
||||
|
||||
Queue.prototype.head = function head () {
|
||||
return this.next
|
||||
}
|
||||
|
||||
Queue.prototype.tail = function tail () {
|
||||
return this.prev
|
||||
}
|
||||
|
||||
Queue.prototype.isEmpty = function isEmpty () {
|
||||
return this.next === this
|
||||
}
|
||||
|
||||
Queue.prototype.isRoot = function isRoot (item) {
|
||||
return this === item
|
||||
}
|
||||
|
||||
function LockStream (stream) {
|
||||
this.locked = false
|
||||
this.queue = []
|
||||
this.stream = stream
|
||||
}
|
||||
exports.LockStream = LockStream
|
||||
|
||||
LockStream.prototype.write = function write (chunks, callback) {
|
||||
var self = this
|
||||
|
||||
// Do not let it interleave
|
||||
if (this.locked) {
|
||||
this.queue.push(function () {
|
||||
return self.write(chunks, callback)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.locked = true
|
||||
|
||||
function done (err, chunks) {
|
||||
self.stream.removeListener('error', done)
|
||||
|
||||
self.locked = false
|
||||
if (self.queue.length > 0) { self.queue.shift()() }
|
||||
callback(err, chunks)
|
||||
}
|
||||
|
||||
this.stream.on('error', done)
|
||||
|
||||
// Accumulate all output data
|
||||
var output = []
|
||||
function onData (chunk) {
|
||||
output.push(chunk)
|
||||
}
|
||||
this.stream.on('data', onData)
|
||||
|
||||
function next (err) {
|
||||
self.stream.removeListener('data', onData)
|
||||
if (err) {
|
||||
return done(err)
|
||||
}
|
||||
|
||||
done(null, output)
|
||||
}
|
||||
|
||||
for (var i = 0; i < chunks.length - 1; i++) { this.stream.write(chunks[i]) }
|
||||
|
||||
if (chunks.length > 0) {
|
||||
this.stream.write(chunks[i], next)
|
||||
} else { process.nextTick(next) }
|
||||
|
||||
if (this.stream.execute) {
|
||||
this.stream.execute(function (err) {
|
||||
if (err) { return done(err) }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Just finds the place in array to insert
|
||||
function binaryLookup (list, item, compare) {
|
||||
var start = 0
|
||||
var end = list.length
|
||||
|
||||
while (start < end) {
|
||||
var pos = (start + end) >> 1
|
||||
var cmp = compare(item, list[pos])
|
||||
|
||||
if (cmp === 0) {
|
||||
start = pos
|
||||
end = pos
|
||||
break
|
||||
} else if (cmp < 0) {
|
||||
end = pos
|
||||
} else {
|
||||
start = pos + 1
|
||||
}
|
||||
}
|
||||
|
||||
return start
|
||||
}
|
||||
exports.binaryLookup = binaryLookup
|
||||
|
||||
function binaryInsert (list, item, compare) {
|
||||
var index = binaryLookup(list, item, compare)
|
||||
|
||||
list.splice(index, 0, item)
|
||||
}
|
||||
exports.binaryInsert = binaryInsert
|
||||
|
||||
function binarySearch (list, item, compare) {
|
||||
var index = binaryLookup(list, item, compare)
|
||||
|
||||
if (index >= list.length) {
|
||||
return -1
|
||||
}
|
||||
|
||||
if (compare(item, list[index]) === 0) {
|
||||
return index
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
exports.binarySearch = binarySearch
|
||||
|
||||
function Timeout (object) {
|
||||
this.delay = 0
|
||||
this.timer = null
|
||||
this.object = object
|
||||
}
|
||||
exports.Timeout = Timeout
|
||||
|
||||
Timeout.prototype.set = function set (delay, callback) {
|
||||
this.delay = delay
|
||||
this.reset()
|
||||
if (!callback) { return }
|
||||
|
||||
if (this.delay === 0) {
|
||||
this.object.removeListener('timeout', callback)
|
||||
} else {
|
||||
this.object.once('timeout', callback)
|
||||
}
|
||||
}
|
||||
|
||||
Timeout.prototype.reset = function reset () {
|
||||
if (this.timer !== null) {
|
||||
clearTimeout(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
|
||||
if (this.delay === 0) { return }
|
||||
|
||||
var self = this
|
||||
this.timer = setTimeout(function () {
|
||||
self.timer = null
|
||||
self.object.emit('timeout')
|
||||
}, this.delay)
|
||||
}
|
174
node_modules/spdy-transport/lib/spdy-transport/window.js
generated
vendored
Normal file
174
node_modules/spdy-transport/lib/spdy-transport/window.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
var debug = {
|
||||
server: require('debug')('spdy:window:server'),
|
||||
client: require('debug')('spdy:window:client')
|
||||
}
|
||||
|
||||
function Side (window, name, options) {
|
||||
EventEmitter.call(this)
|
||||
|
||||
this.name = name
|
||||
this.window = window
|
||||
this.current = options.size
|
||||
this.max = options.size
|
||||
this.limit = options.max
|
||||
this.lowWaterMark = options.lowWaterMark === undefined
|
||||
? this.max / 2
|
||||
: options.lowWaterMark
|
||||
|
||||
this._refilling = false
|
||||
this._refillQueue = []
|
||||
}
|
||||
util.inherits(Side, EventEmitter)
|
||||
|
||||
Side.prototype.setMax = function setMax (max) {
|
||||
this.window.debug('id=%d side=%s setMax=%d',
|
||||
this.window.id,
|
||||
this.name,
|
||||
max)
|
||||
this.max = max
|
||||
this.lowWaterMark = this.max / 2
|
||||
}
|
||||
|
||||
Side.prototype.updateMax = function updateMax (max) {
|
||||
var delta = max - this.max
|
||||
this.window.debug('id=%d side=%s updateMax=%d delta=%d',
|
||||
this.window.id,
|
||||
this.name,
|
||||
max,
|
||||
delta)
|
||||
|
||||
this.max = max
|
||||
this.lowWaterMark = max / 2
|
||||
|
||||
this.update(delta)
|
||||
}
|
||||
|
||||
Side.prototype.setLowWaterMark = function setLowWaterMark (lwm) {
|
||||
this.lowWaterMark = lwm
|
||||
}
|
||||
|
||||
Side.prototype.update = function update (size, callback) {
|
||||
// Not enough space for the update, wait for refill
|
||||
if (size <= 0 && callback && this.isEmpty()) {
|
||||
this.window.debug('id=%d side=%s wait for refill=%d [%d/%d]',
|
||||
this.window.id,
|
||||
this.name,
|
||||
-size,
|
||||
this.current,
|
||||
this.max)
|
||||
this._refillQueue.push({
|
||||
size: size,
|
||||
callback: callback
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.current += size
|
||||
|
||||
if (this.current > this.limit) {
|
||||
this.emit('overflow')
|
||||
return
|
||||
}
|
||||
|
||||
this.window.debug('id=%d side=%s update by=%d [%d/%d]',
|
||||
this.window.id,
|
||||
this.name,
|
||||
size,
|
||||
this.current,
|
||||
this.max)
|
||||
|
||||
// Time to send WINDOW_UPDATE
|
||||
if (size < 0 && this.isDraining()) {
|
||||
this.window.debug('id=%d side=%s drained', this.window.id, this.name)
|
||||
this.emit('drain')
|
||||
}
|
||||
|
||||
// Time to write
|
||||
if (size > 0 && this.current > 0 && this.current <= size) {
|
||||
this.window.debug('id=%d side=%s full', this.window.id, this.name)
|
||||
this.emit('full')
|
||||
}
|
||||
|
||||
this._processRefillQueue()
|
||||
|
||||
if (callback) { process.nextTick(callback) }
|
||||
}
|
||||
|
||||
Side.prototype.getCurrent = function getCurrent () {
|
||||
return this.current
|
||||
}
|
||||
|
||||
Side.prototype.getMax = function getMax () {
|
||||
return this.max
|
||||
}
|
||||
|
||||
Side.prototype.getDelta = function getDelta () {
|
||||
return this.max - this.current
|
||||
}
|
||||
|
||||
Side.prototype.isDraining = function isDraining () {
|
||||
return this.current <= this.lowWaterMark
|
||||
}
|
||||
|
||||
Side.prototype.isEmpty = function isEmpty () {
|
||||
return this.current <= 0
|
||||
}
|
||||
|
||||
// Private
|
||||
|
||||
Side.prototype._processRefillQueue = function _processRefillQueue () {
|
||||
// Prevent recursion
|
||||
if (this._refilling) {
|
||||
return
|
||||
}
|
||||
this._refilling = true
|
||||
|
||||
while (this._refillQueue.length > 0) {
|
||||
var item = this._refillQueue[0]
|
||||
|
||||
if (this.isEmpty()) {
|
||||
break
|
||||
}
|
||||
|
||||
this.window.debug('id=%d side=%s refilled for size=%d',
|
||||
this.window.id,
|
||||
this.name,
|
||||
-item.size)
|
||||
|
||||
this._refillQueue.shift()
|
||||
this.update(item.size, item.callback)
|
||||
}
|
||||
|
||||
this._refilling = false
|
||||
}
|
||||
|
||||
function Window (options) {
|
||||
this.id = options.id
|
||||
this.isServer = options.isServer
|
||||
this.debug = this.isServer ? debug.server : debug.client
|
||||
|
||||
this.recv = new Side(this, 'recv', options.recv)
|
||||
this.send = new Side(this, 'send', options.send)
|
||||
}
|
||||
module.exports = Window
|
||||
|
||||
Window.prototype.clone = function clone (id) {
|
||||
return new Window({
|
||||
id: id,
|
||||
isServer: this.isServer,
|
||||
recv: {
|
||||
size: this.recv.max,
|
||||
max: this.recv.limit,
|
||||
lowWaterMark: this.recv.lowWaterMark
|
||||
},
|
||||
send: {
|
||||
size: this.send.max,
|
||||
max: this.send.limit,
|
||||
lowWaterMark: this.send.lowWaterMark
|
||||
}
|
||||
})
|
||||
}
|
395
node_modules/spdy-transport/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
395
node_modules/spdy-transport/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,395 @@
|
||||
|
||||
3.1.0 / 2017-09-26
|
||||
==================
|
||||
|
||||
* Add `DEBUG_HIDE_DATE` env var (#486)
|
||||
* Remove ReDoS regexp in %o formatter (#504)
|
||||
* Remove "component" from package.json
|
||||
* Remove `component.json`
|
||||
* Ignore package-lock.json
|
||||
* Examples: fix colors printout
|
||||
* Fix: browser detection
|
||||
* Fix: spelling mistake (#496, @EdwardBetts)
|
||||
|
||||
3.0.1 / 2017-08-24
|
||||
==================
|
||||
|
||||
* Fix: Disable colors in Edge and Internet Explorer (#489)
|
||||
|
||||
3.0.0 / 2017-08-08
|
||||
==================
|
||||
|
||||
* Breaking: Remove DEBUG_FD (#406)
|
||||
* Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418)
|
||||
* Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408)
|
||||
* Addition: document `enabled` flag (#465)
|
||||
* Addition: add 256 colors mode (#481)
|
||||
* Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440)
|
||||
* Update: component: update "ms" to v2.0.0
|
||||
* Update: separate the Node and Browser tests in Travis-CI
|
||||
* Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots
|
||||
* Update: separate Node.js and web browser examples for organization
|
||||
* Update: update "browserify" to v14.4.0
|
||||
* Fix: fix Readme typo (#473)
|
||||
|
||||
2.6.9 / 2017-09-22
|
||||
==================
|
||||
|
||||
* remove ReDoS regexp in %o formatter (#504)
|
||||
|
||||
2.6.8 / 2017-05-18
|
||||
==================
|
||||
|
||||
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||
|
||||
2.6.7 / 2017-05-16
|
||||
==================
|
||||
|
||||
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||
* Docs: Fix typo (#455, @msasad)
|
||||
|
||||
2.6.5 / 2017-04-27
|
||||
==================
|
||||
|
||||
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||
|
||||
|
||||
2.6.4 / 2017-04-20
|
||||
==================
|
||||
|
||||
* Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||
|
||||
2.6.3 / 2017-03-13
|
||||
==================
|
||||
|
||||
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||
* Docs: Changelog fix (@thebigredgeek)
|
||||
|
||||
2.6.2 / 2017-03-10
|
||||
==================
|
||||
|
||||
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||
* Docs: Add Slackin invite badge (@tootallnate)
|
||||
|
||||
2.6.1 / 2017-02-10
|
||||
==================
|
||||
|
||||
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||
|
||||
2.6.0 / 2016-12-28
|
||||
==================
|
||||
|
||||
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||
|
||||
2.5.2 / 2016-12-25
|
||||
==================
|
||||
|
||||
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||
* Docs: fixed README typo (#391, @lurch)
|
||||
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||
|
||||
2.5.1 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: babel-core compatibility
|
||||
|
||||
2.5.0 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||
* Fix: webworker compatibility (@thebigredgeek)
|
||||
* Fix: output formatting issue (#388, @kribblo)
|
||||
* Fix: babel-loader compatibility (#383, @escwald)
|
||||
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||
* Test: coveralls integration (#378, @yamikuronue)
|
||||
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||
|
||||
2.4.5 / 2016-12-17
|
||||
==================
|
||||
|
||||
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||
* Fix: custom log function (#379, @hsiliev)
|
||||
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||
|
||||
2.4.4 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||
|
||||
2.4.3 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||
|
||||
2.4.2 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: browser colors (#367, @tootallnate)
|
||||
* Misc: travis ci integration (@thebigredgeek)
|
||||
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||
|
||||
2.4.1 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: typo that broke the package (#356)
|
||||
|
||||
2.4.0 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||
* Improvement: allow colors in workers (#335, @botverse)
|
||||
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
19
node_modules/spdy-transport/node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/spdy-transport/node_modules/debug/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
|
455
node_modules/spdy-transport/node_modules/debug/README.md
generated
vendored
Normal file
455
node_modules/spdy-transport/node_modules/debug/README.md
generated
vendored
Normal file
@@ -0,0 +1,455 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
A tiny JavaScript debugging utility modelled after Node.js core's debugging
|
||||
technique. Works in Node.js and web browsers.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example [_app.js_](./examples/node/app.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %o', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example [_worker.js_](./examples/node/worker.js):
|
||||
|
||||
```js
|
||||
var a = require('debug')('worker:a')
|
||||
, b = require('debug')('worker:b');
|
||||
|
||||
function work() {
|
||||
a('doing lots of uninteresting work');
|
||||
setTimeout(work, Math.random() * 1000);
|
||||
}
|
||||
|
||||
work();
|
||||
|
||||
function workb() {
|
||||
b('doing some work');
|
||||
setTimeout(workb, Math.random() * 2000);
|
||||
}
|
||||
|
||||
workb();
|
||||
```
|
||||
|
||||
The `DEBUG` environment variable is then used to enable these based on space or
|
||||
comma-delimited names.
|
||||
|
||||
Here are some examples:
|
||||
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||
|
||||
#### Windows command prompt notes
|
||||
|
||||
##### CMD
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
set DEBUG=* & node app.js
|
||||
```
|
||||
|
||||
##### PowerShell (VS Code default)
|
||||
|
||||
PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
$env:DEBUG='app';node app.js
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
npm script example:
|
||||
```js
|
||||
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
|
||||
```
|
||||
|
||||
## Namespace Colors
|
||||
|
||||
Every debug instance has a color generated for it based on its namespace name.
|
||||
This helps when visually parsing the debug output to identify which debug instance
|
||||
a debug line belongs to.
|
||||
|
||||
#### Node.js
|
||||
|
||||
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
|
||||
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
|
||||
otherwise debug will only use a small handful of basic colors.
|
||||
|
||||
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
|
||||
|
||||
#### Web Browser
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
|
||||
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
|
||||
|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has
|
||||
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
|
||||
instead of listing all three with
|
||||
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
|
||||
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character.
|
||||
For example, `DEBUG=*,-connect:*` would include all debuggers except those
|
||||
starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
|
||||
Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object.
|
||||
For example, if you wanted to add support for rendering a Buffer as hex with
|
||||
`%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
|
||||
## Browser Support
|
||||
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example [_stdout.js_](./examples/node/stdout.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
//creates new debug instance with extended namespace
|
||||
const logSign = log.extend('sign');
|
||||
const logLogin = log.extend('login');
|
||||
|
||||
log('hello'); // auth hello
|
||||
logSign('hello'); //auth:sign hello
|
||||
logLogin('hello'); //auth:login hello
|
||||
```
|
||||
|
||||
## Set dynamically
|
||||
|
||||
You can also enable debug dynamically by calling the `enable()` method :
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
|
||||
console.log(1, debug.enabled('test'));
|
||||
|
||||
debug.enable('test');
|
||||
console.log(2, debug.enabled('test'));
|
||||
|
||||
debug.disable();
|
||||
console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
=> false
|
||||
```
|
||||
|
||||
`disable()`
|
||||
|
||||
Will disable all namespaces. The functions returns the namespaces currently
|
||||
enabled (and skipped). This can be useful if you want to disable debugging
|
||||
temporarily without knowing what was enabled to begin with.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
debug.enable('foo:*,-foo:bar');
|
||||
let namespaces = debug.disable();
|
||||
debug.enable(namespaces);
|
||||
```
|
||||
|
||||
Note: There is no guarantee that the string will be identical to the initial
|
||||
enable string, but semantically they will be identical.
|
||||
|
||||
## Checking whether a debug target is enabled
|
||||
|
||||
After you've created a debug instance, you can determine whether or not it is
|
||||
enabled by checking the `enabled` property:
|
||||
|
||||
```javascript
|
||||
const debug = require('debug')('http');
|
||||
|
||||
if (debug.enabled) {
|
||||
// do stuff...
|
||||
}
|
||||
```
|
||||
|
||||
You can also manually toggle this property to force the debug instance to be
|
||||
enabled or disabled.
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
912
node_modules/spdy-transport/node_modules/debug/dist/debug.js
generated
vendored
Normal file
912
node_modules/spdy-transport/node_modules/debug/dist/debug.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
63
node_modules/spdy-transport/node_modules/debug/package.json
generated
vendored
Normal file
63
node_modules/spdy-transport/node_modules/debug/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"version": "4.1.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"files": [
|
||||
"src",
|
||||
"dist/debug.js",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"lint": "xo",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test:node": "istanbul cover _mocha -- test.js",
|
||||
"pretest:browser": "npm run build",
|
||||
"test:browser": "karma start --single-run",
|
||||
"prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .",
|
||||
"build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js",
|
||||
"build:test": "babel -d dist test.js",
|
||||
"build": "npm run build:debug && npm run build:test",
|
||||
"clean": "rimraf dist coverage",
|
||||
"test:coverage": "cat ./coverage/lcov.info | coveralls"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": "^2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"browserify": "14.4.0",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^3.0.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^3.0.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"browser": "./src/browser.js",
|
||||
"unpkg": "./dist/debug.js"
|
||||
}
|
264
node_modules/spdy-transport/node_modules/debug/src/browser.js
generated
vendored
Normal file
264
node_modules/spdy-transport/node_modules/debug/src/browser.js
generated
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*/
|
||||
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'#0000CC',
|
||||
'#0000FF',
|
||||
'#0033CC',
|
||||
'#0033FF',
|
||||
'#0066CC',
|
||||
'#0066FF',
|
||||
'#0099CC',
|
||||
'#0099FF',
|
||||
'#00CC00',
|
||||
'#00CC33',
|
||||
'#00CC66',
|
||||
'#00CC99',
|
||||
'#00CCCC',
|
||||
'#00CCFF',
|
||||
'#3300CC',
|
||||
'#3300FF',
|
||||
'#3333CC',
|
||||
'#3333FF',
|
||||
'#3366CC',
|
||||
'#3366FF',
|
||||
'#3399CC',
|
||||
'#3399FF',
|
||||
'#33CC00',
|
||||
'#33CC33',
|
||||
'#33CC66',
|
||||
'#33CC99',
|
||||
'#33CCCC',
|
||||
'#33CCFF',
|
||||
'#6600CC',
|
||||
'#6600FF',
|
||||
'#6633CC',
|
||||
'#6633FF',
|
||||
'#66CC00',
|
||||
'#66CC33',
|
||||
'#9900CC',
|
||||
'#9900FF',
|
||||
'#9933CC',
|
||||
'#9933FF',
|
||||
'#99CC00',
|
||||
'#99CC33',
|
||||
'#CC0000',
|
||||
'#CC0033',
|
||||
'#CC0066',
|
||||
'#CC0099',
|
||||
'#CC00CC',
|
||||
'#CC00FF',
|
||||
'#CC3300',
|
||||
'#CC3333',
|
||||
'#CC3366',
|
||||
'#CC3399',
|
||||
'#CC33CC',
|
||||
'#CC33FF',
|
||||
'#CC6600',
|
||||
'#CC6633',
|
||||
'#CC9900',
|
||||
'#CC9933',
|
||||
'#CCCC00',
|
||||
'#CCCC33',
|
||||
'#FF0000',
|
||||
'#FF0033',
|
||||
'#FF0066',
|
||||
'#FF0099',
|
||||
'#FF00CC',
|
||||
'#FF00FF',
|
||||
'#FF3300',
|
||||
'#FF3333',
|
||||
'#FF3366',
|
||||
'#FF3399',
|
||||
'#FF33CC',
|
||||
'#FF33FF',
|
||||
'#FF6600',
|
||||
'#FF6633',
|
||||
'#FF9900',
|
||||
'#FF9933',
|
||||
'#FFCC00',
|
||||
'#FFCC33'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Internet Explorer and Edge do not support colors.
|
||||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// Is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// Double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
args[0] = (this.useColors ? '%c' : '') +
|
||||
this.namespace +
|
||||
(this.useColors ? ' %c' : ' ') +
|
||||
args[0] +
|
||||
(this.useColors ? '%c ' : ' ') +
|
||||
'+' + module.exports.humanize(this.diff);
|
||||
|
||||
if (!this.useColors) {
|
||||
return;
|
||||
}
|
||||
|
||||
const c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit');
|
||||
|
||||
// The final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
let index = 0;
|
||||
let lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, match => {
|
||||
if (match === '%%') {
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
if (match === '%c') {
|
||||
// We only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
function log(...args) {
|
||||
// This hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return typeof console === 'object' &&
|
||||
console.log &&
|
||||
console.log(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (namespaces) {
|
||||
exports.storage.setItem('debug', namespaces);
|
||||
} else {
|
||||
exports.storage.removeItem('debug');
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
function load() {
|
||||
let r;
|
||||
try {
|
||||
r = exports.storage.getItem('debug');
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||||
// The Browser also has localStorage in the global context.
|
||||
return localStorage;
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
|
||||
const {formatters} = module.exports;
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
formatters.j = function (v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (error) {
|
||||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||||
}
|
||||
};
|
266
node_modules/spdy-transport/node_modules/debug/src/common.js
generated
vendored
Normal file
266
node_modules/spdy-transport/node_modules/debug/src/common.js
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*/
|
||||
|
||||
function setup(env) {
|
||||
createDebug.debug = createDebug;
|
||||
createDebug.default = createDebug;
|
||||
createDebug.coerce = coerce;
|
||||
createDebug.disable = disable;
|
||||
createDebug.enable = enable;
|
||||
createDebug.enabled = enabled;
|
||||
createDebug.humanize = require('ms');
|
||||
|
||||
Object.keys(env).forEach(key => {
|
||||
createDebug[key] = env[key];
|
||||
});
|
||||
|
||||
/**
|
||||
* Active `debug` instances.
|
||||
*/
|
||||
createDebug.instances = [];
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
createDebug.formatters = {};
|
||||
|
||||
/**
|
||||
* Selects a color for a debug namespace
|
||||
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
||||
* @return {Number|String} An ANSI color code for the given namespace
|
||||
* @api private
|
||||
*/
|
||||
function selectColor(namespace) {
|
||||
let hash = 0;
|
||||
|
||||
for (let i = 0; i < namespace.length; i++) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||||
}
|
||||
createDebug.selectColor = selectColor;
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
function createDebug(namespace) {
|
||||
let prevTime;
|
||||
|
||||
function debug(...args) {
|
||||
// Disabled?
|
||||
if (!debug.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const self = debug;
|
||||
|
||||
// Set `diff` timestamp
|
||||
const curr = Number(new Date());
|
||||
const ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
args[0] = createDebug.coerce(args[0]);
|
||||
|
||||
if (typeof args[0] !== 'string') {
|
||||
// Anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// Apply any `formatters` transformations
|
||||
let index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
||||
// If we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') {
|
||||
return match;
|
||||
}
|
||||
index++;
|
||||
const formatter = createDebug.formatters[format];
|
||||
if (typeof formatter === 'function') {
|
||||
const val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// Now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// Apply env-specific formatting (colors, etc.)
|
||||
createDebug.formatArgs.call(self, args);
|
||||
|
||||
const logFn = self.log || createDebug.log;
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = createDebug.enabled(namespace);
|
||||
debug.useColors = createDebug.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
debug.destroy = destroy;
|
||||
debug.extend = extend;
|
||||
// Debug.formatArgs = formatArgs;
|
||||
// debug.rawLog = rawLog;
|
||||
|
||||
// env-specific initialization logic for debug instances
|
||||
if (typeof createDebug.init === 'function') {
|
||||
createDebug.init(debug);
|
||||
}
|
||||
|
||||
createDebug.instances.push(debug);
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
const index = createDebug.instances.indexOf(this);
|
||||
if (index !== -1) {
|
||||
createDebug.instances.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
newDebug.log = this.log;
|
||||
return newDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function enable(namespaces) {
|
||||
createDebug.save(namespaces);
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
let i;
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
const len = split.length;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!split[i]) {
|
||||
// ignore empty strings
|
||||
continue;
|
||||
}
|
||||
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
|
||||
if (namespaces[0] === '-') {
|
||||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < createDebug.instances.length; i++) {
|
||||
const instance = createDebug.instances[i];
|
||||
instance.enabled = createDebug.enabled(instance.namespace);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @return {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function disable() {
|
||||
const namespaces = [
|
||||
...createDebug.names.map(toNamespace),
|
||||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||||
].join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
function enabled(name) {
|
||||
if (name[name.length - 1] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
||||
let i;
|
||||
let len;
|
||||
|
||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||||
if (createDebug.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||||
if (createDebug.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert regexp to namespace
|
||||
*
|
||||
* @param {RegExp} regxep
|
||||
* @return {String} namespace
|
||||
* @api private
|
||||
*/
|
||||
function toNamespace(regexp) {
|
||||
return regexp.toString()
|
||||
.substring(2, regexp.toString().length - 2)
|
||||
.replace(/\.\*\?$/, '*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) {
|
||||
return val.stack || val.message;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
createDebug.enable(createDebug.load());
|
||||
|
||||
return createDebug;
|
||||
}
|
||||
|
||||
module.exports = setup;
|
10
node_modules/spdy-transport/node_modules/debug/src/index.js
generated
vendored
Normal file
10
node_modules/spdy-transport/node_modules/debug/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
257
node_modules/spdy-transport/node_modules/debug/src/node.js
generated
vendored
Normal file
257
node_modules/spdy-transport/node_modules/debug/src/node.js
generated
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
const tty = require('tty');
|
||||
const util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*/
|
||||
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
try {
|
||||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||||
exports.colors = [
|
||||
20,
|
||||
21,
|
||||
26,
|
||||
27,
|
||||
32,
|
||||
33,
|
||||
38,
|
||||
39,
|
||||
40,
|
||||
41,
|
||||
42,
|
||||
43,
|
||||
44,
|
||||
45,
|
||||
56,
|
||||
57,
|
||||
62,
|
||||
63,
|
||||
68,
|
||||
69,
|
||||
74,
|
||||
75,
|
||||
76,
|
||||
77,
|
||||
78,
|
||||
79,
|
||||
80,
|
||||
81,
|
||||
92,
|
||||
93,
|
||||
98,
|
||||
99,
|
||||
112,
|
||||
113,
|
||||
128,
|
||||
129,
|
||||
134,
|
||||
135,
|
||||
148,
|
||||
149,
|
||||
160,
|
||||
161,
|
||||
162,
|
||||
163,
|
||||
164,
|
||||
165,
|
||||
166,
|
||||
167,
|
||||
168,
|
||||
169,
|
||||
170,
|
||||
171,
|
||||
172,
|
||||
173,
|
||||
178,
|
||||
179,
|
||||
184,
|
||||
185,
|
||||
196,
|
||||
197,
|
||||
198,
|
||||
199,
|
||||
200,
|
||||
201,
|
||||
202,
|
||||
203,
|
||||
204,
|
||||
205,
|
||||
206,
|
||||
207,
|
||||
208,
|
||||
209,
|
||||
214,
|
||||
215,
|
||||
220,
|
||||
221
|
||||
];
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||
}
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce((obj, key) => {
|
||||
// Camel-case
|
||||
const prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, (_, k) => {
|
||||
return k.toUpperCase();
|
||||
});
|
||||
|
||||
// Coerce string value into JS value
|
||||
let val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||||
val = true;
|
||||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||||
val = false;
|
||||
} else if (val === 'null') {
|
||||
val = null;
|
||||
} else {
|
||||
val = Number(val);
|
||||
}
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts ?
|
||||
Boolean(exports.inspectOpts.colors) :
|
||||
tty.isatty(process.stderr.fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
const {namespace: name, useColors} = this;
|
||||
|
||||
if (useColors) {
|
||||
const c = this.color;
|
||||
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
||||
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
||||
} else {
|
||||
args[0] = getDate() + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
function getDate() {
|
||||
if (exports.inspectOpts.hideDate) {
|
||||
return '';
|
||||
}
|
||||
return new Date().toISOString() + ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||||
*/
|
||||
|
||||
function log(...args) {
|
||||
return process.stderr.write(util.format(...args) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
function save(namespaces) {
|
||||
if (namespaces) {
|
||||
process.env.DEBUG = namespaces;
|
||||
} else {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init(debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
const keys = Object.keys(exports.inspectOpts);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
|
||||
const {formatters} = module.exports;
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
formatters.o = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.replace(/\s*\n\s*/g, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
formatters.O = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
162
node_modules/spdy-transport/node_modules/ms/index.js
generated
vendored
Normal file
162
node_modules/spdy-transport/node_modules/ms/index.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var w = d * 7;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isFinite(val)) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'weeks':
|
||||
case 'week':
|
||||
case 'w':
|
||||
return n * w;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
var msAbs = Math.abs(ms);
|
||||
if (msAbs >= d) {
|
||||
return plural(ms, msAbs, d, 'day');
|
||||
}
|
||||
if (msAbs >= h) {
|
||||
return plural(ms, msAbs, h, 'hour');
|
||||
}
|
||||
if (msAbs >= m) {
|
||||
return plural(ms, msAbs, m, 'minute');
|
||||
}
|
||||
if (msAbs >= s) {
|
||||
return plural(ms, msAbs, s, 'second');
|
||||
}
|
||||
return ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, msAbs, n, name) {
|
||||
var isPlural = msAbs >= n * 1.5;
|
||||
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
||||
}
|
21
node_modules/spdy-transport/node_modules/ms/license.md
generated
vendored
Normal file
21
node_modules/spdy-transport/node_modules/ms/license.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
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.
|
37
node_modules/spdy-transport/node_modules/ms/package.json
generated
vendored
Normal file
37
node_modules/spdy-transport/node_modules/ms/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "ms",
|
||||
"version": "2.1.2",
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"repository": "zeit/ms",
|
||||
"main": "./index",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.14.3",
|
||||
"lint-staged": "5.0.0",
|
||||
"mocha": "4.0.1"
|
||||
}
|
||||
}
|
60
node_modules/spdy-transport/node_modules/ms/readme.md
generated
vendored
Normal file
60
node_modules/spdy-transport/node_modules/ms/readme.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://spectrum.chat/zeit)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
ms('-3 days') // -259200000
|
||||
ms('-1h') // -3600000
|
||||
ms('-200') // -200
|
||||
```
|
||||
|
||||
### Convert from Milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(-3 * 60000) // "-3m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time Format Written-Out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [Node.js](https://nodejs.org) and in the browser
|
||||
- If a number is supplied to `ms`, a string with a unit is returned
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
||||
|
||||
## Related Packages
|
||||
|
||||
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
||||
|
||||
## Caught a Bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
38
node_modules/spdy-transport/node_modules/readable-stream/CONTRIBUTING.md
generated
vendored
Normal file
38
node_modules/spdy-transport/node_modules/readable-stream/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
* (a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
* (b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
* (c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
* (d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
|
||||
## Moderation Policy
|
||||
|
||||
The [Node.js Moderation Policy] applies to this WG.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
The [Node.js Code of Conduct][] applies to this WG.
|
||||
|
||||
[Node.js Code of Conduct]:
|
||||
https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
|
||||
[Node.js Moderation Policy]:
|
||||
https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
|
136
node_modules/spdy-transport/node_modules/readable-stream/GOVERNANCE.md
generated
vendored
Normal file
136
node_modules/spdy-transport/node_modules/readable-stream/GOVERNANCE.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
### Streams Working Group
|
||||
|
||||
The Node.js Streams is jointly governed by a Working Group
|
||||
(WG)
|
||||
that is responsible for high-level guidance of the project.
|
||||
|
||||
The WG has final authority over this project including:
|
||||
|
||||
* Technical direction
|
||||
* Project governance and process (including this policy)
|
||||
* Contribution policy
|
||||
* GitHub repository hosting
|
||||
* Conduct guidelines
|
||||
* Maintaining the list of additional Collaborators
|
||||
|
||||
For the current list of WG members, see the project
|
||||
[README.md](./README.md#current-project-team-members).
|
||||
|
||||
### Collaborators
|
||||
|
||||
The readable-stream GitHub repository is
|
||||
maintained by the WG and additional Collaborators who are added by the
|
||||
WG on an ongoing basis.
|
||||
|
||||
Individuals making significant and valuable contributions are made
|
||||
Collaborators and given commit-access to the project. These
|
||||
individuals are identified by the WG and their addition as
|
||||
Collaborators is discussed during the WG meeting.
|
||||
|
||||
_Note:_ If you make a significant contribution and are not considered
|
||||
for commit-access log an issue or contact a WG member directly and it
|
||||
will be brought up in the next WG meeting.
|
||||
|
||||
Modifications of the contents of the readable-stream repository are
|
||||
made on
|
||||
a collaborative basis. Anybody with a GitHub account may propose a
|
||||
modification via pull request and it will be considered by the project
|
||||
Collaborators. All pull requests must be reviewed and accepted by a
|
||||
Collaborator with sufficient expertise who is able to take full
|
||||
responsibility for the change. In the case of pull requests proposed
|
||||
by an existing Collaborator, an additional Collaborator is required
|
||||
for sign-off. Consensus should be sought if additional Collaborators
|
||||
participate and there is disagreement around a particular
|
||||
modification. See _Consensus Seeking Process_ below for further detail
|
||||
on the consensus model used for governance.
|
||||
|
||||
Collaborators may opt to elevate significant or controversial
|
||||
modifications, or modifications that have not found consensus to the
|
||||
WG for discussion by assigning the ***WG-agenda*** tag to a pull
|
||||
request or issue. The WG should serve as the final arbiter where
|
||||
required.
|
||||
|
||||
For the current list of Collaborators, see the project
|
||||
[README.md](./README.md#members).
|
||||
|
||||
### WG Membership
|
||||
|
||||
WG seats are not time-limited. There is no fixed size of the WG.
|
||||
However, the expected target is between 6 and 12, to ensure adequate
|
||||
coverage of important areas of expertise, balanced with the ability to
|
||||
make decisions efficiently.
|
||||
|
||||
There is no specific set of requirements or qualifications for WG
|
||||
membership beyond these rules.
|
||||
|
||||
The WG may add additional members to the WG by unanimous consensus.
|
||||
|
||||
A WG member may be removed from the WG by voluntary resignation, or by
|
||||
unanimous consensus of all other WG members.
|
||||
|
||||
Changes to WG membership should be posted in the agenda, and may be
|
||||
suggested as any other agenda item (see "WG Meetings" below).
|
||||
|
||||
If an addition or removal is proposed during a meeting, and the full
|
||||
WG is not in attendance to participate, then the addition or removal
|
||||
is added to the agenda for the subsequent meeting. This is to ensure
|
||||
that all members are given the opportunity to participate in all
|
||||
membership decisions. If a WG member is unable to attend a meeting
|
||||
where a planned membership decision is being made, then their consent
|
||||
is assumed.
|
||||
|
||||
No more than 1/3 of the WG members may be affiliated with the same
|
||||
employer. If removal or resignation of a WG member, or a change of
|
||||
employment by a WG member, creates a situation where more than 1/3 of
|
||||
the WG membership shares an employer, then the situation must be
|
||||
immediately remedied by the resignation or removal of one or more WG
|
||||
members affiliated with the over-represented employer(s).
|
||||
|
||||
### WG Meetings
|
||||
|
||||
The WG meets occasionally on a Google Hangout On Air. A designated moderator
|
||||
approved by the WG runs the meeting. Each meeting should be
|
||||
published to YouTube.
|
||||
|
||||
Items are added to the WG agenda that are considered contentious or
|
||||
are modifications of governance, contribution policy, WG membership,
|
||||
or release process.
|
||||
|
||||
The intention of the agenda is not to approve or review all patches;
|
||||
that should happen continuously on GitHub and be handled by the larger
|
||||
group of Collaborators.
|
||||
|
||||
Any community member or contributor can ask that something be added to
|
||||
the next meeting's agenda by logging a GitHub Issue. Any Collaborator,
|
||||
WG member or the moderator can add the item to the agenda by adding
|
||||
the ***WG-agenda*** tag to the issue.
|
||||
|
||||
Prior to each WG meeting the moderator will share the Agenda with
|
||||
members of the WG. WG members can add any items they like to the
|
||||
agenda at the beginning of each meeting. The moderator and the WG
|
||||
cannot veto or remove items.
|
||||
|
||||
The WG may invite persons or representatives from certain projects to
|
||||
participate in a non-voting capacity.
|
||||
|
||||
The moderator is responsible for summarizing the discussion of each
|
||||
agenda item and sends it as a pull request after the meeting.
|
||||
|
||||
### Consensus Seeking Process
|
||||
|
||||
The WG follows a
|
||||
[Consensus
|
||||
Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making)
|
||||
decision-making model.
|
||||
|
||||
When an agenda item has appeared to reach a consensus the moderator
|
||||
will ask "Does anyone object?" as a final call for dissent from the
|
||||
consensus.
|
||||
|
||||
If an agenda item cannot reach a consensus a WG member can call for
|
||||
either a closing vote or a vote to table the issue to the next
|
||||
meeting. The call for a vote must be seconded by a majority of the WG
|
||||
or else the discussion will continue. Simple majority wins.
|
||||
|
||||
Note that changes to WG membership require a majority consensus. See
|
||||
"WG Membership" above.
|
47
node_modules/spdy-transport/node_modules/readable-stream/LICENSE
generated
vendored
Normal file
47
node_modules/spdy-transport/node_modules/readable-stream/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
Node.js is licensed for use as follows:
|
||||
|
||||
"""
|
||||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
This license applies to parts of Node.js originating from the
|
||||
https://github.com/joyent/node repository:
|
||||
|
||||
"""
|
||||
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
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.
|
||||
"""
|
106
node_modules/spdy-transport/node_modules/readable-stream/README.md
generated
vendored
Normal file
106
node_modules/spdy-transport/node_modules/readable-stream/README.md
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
# readable-stream
|
||||
|
||||
***Node.js core streams for userland*** [](https://travis-ci.com/nodejs/readable-stream)
|
||||
|
||||
|
||||
[](https://nodei.co/npm/readable-stream/)
|
||||
[](https://nodei.co/npm/readable-stream/)
|
||||
|
||||
|
||||
[](https://saucelabs.com/u/readabe-stream)
|
||||
|
||||
```bash
|
||||
npm install --save readable-stream
|
||||
```
|
||||
|
||||
This package is a mirror of the streams implementations in Node.js.
|
||||
|
||||
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.19.0/docs/api/stream.html).
|
||||
|
||||
If you want to guarantee a stable streams base, regardless of what version of
|
||||
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
|
||||
|
||||
As of version 2.0.0 **readable-stream** uses semantic versioning.
|
||||
|
||||
## Version 3.x.x
|
||||
|
||||
v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows:
|
||||
|
||||
1. Error codes: https://github.com/nodejs/node/pull/13310,
|
||||
https://github.com/nodejs/node/pull/13291,
|
||||
https://github.com/nodejs/node/pull/16589,
|
||||
https://github.com/nodejs/node/pull/15042,
|
||||
https://github.com/nodejs/node/pull/15665,
|
||||
https://github.com/nodejs/readable-stream/pull/344
|
||||
2. 'readable' have precedence over flowing
|
||||
https://github.com/nodejs/node/pull/18994
|
||||
3. make virtual methods errors consistent
|
||||
https://github.com/nodejs/node/pull/18813
|
||||
4. updated streams error handling
|
||||
https://github.com/nodejs/node/pull/18438
|
||||
5. writable.end should return this.
|
||||
https://github.com/nodejs/node/pull/18780
|
||||
6. readable continues to read when push('')
|
||||
https://github.com/nodejs/node/pull/18211
|
||||
7. add custom inspect to BufferList
|
||||
https://github.com/nodejs/node/pull/17907
|
||||
8. always defer 'readable' with nextTick
|
||||
https://github.com/nodejs/node/pull/17979
|
||||
|
||||
## Version 2.x.x
|
||||
v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11.
|
||||
|
||||
### Big Thanks
|
||||
|
||||
Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce]
|
||||
|
||||
# Usage
|
||||
|
||||
You can swap your `require('stream')` with `require('readable-stream')`
|
||||
without any changes, if you are just using one of the main classes and
|
||||
functions.
|
||||
|
||||
```js
|
||||
const {
|
||||
Readable,
|
||||
Writable,
|
||||
Transform,
|
||||
Duplex,
|
||||
pipeline,
|
||||
finished
|
||||
} = require('readable-stream')
|
||||
````
|
||||
|
||||
Note that `require('stream')` will return `Stream`, while
|
||||
`require('readable-stream')` will return `Readable`. We discourage using
|
||||
whatever is exported directly, but rather use one of the properties as
|
||||
shown in the example above.
|
||||
|
||||
# Streams Working Group
|
||||
|
||||
`readable-stream` is maintained by the Streams Working Group, which
|
||||
oversees the development and maintenance of the Streams API within
|
||||
Node.js. The responsibilities of the Streams Working Group include:
|
||||
|
||||
* Addressing stream issues on the Node.js issue tracker.
|
||||
* Authoring and editing stream documentation within the Node.js project.
|
||||
* Reviewing changes to stream subclasses within the Node.js project.
|
||||
* Redirecting changes to streams from the Node.js project to this
|
||||
project.
|
||||
* Assisting in the implementation of stream providers within Node.js.
|
||||
* Recommending versions of `readable-stream` to be included in Node.js.
|
||||
* Messaging about the future of streams to give the community advance
|
||||
notice of changes.
|
||||
|
||||
<a name="members"></a>
|
||||
## Team Members
|
||||
|
||||
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
|
||||
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
|
||||
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
|
||||
* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
|
||||
- Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
|
||||
* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com>
|
||||
* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com>
|
||||
|
||||
[sauce]: https://saucelabs.com
|
127
node_modules/spdy-transport/node_modules/readable-stream/errors-browser.js
generated
vendored
Normal file
127
node_modules/spdy-transport/node_modules/readable-stream/errors-browser.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
'use strict';
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
var codes = {};
|
||||
|
||||
function createErrorType(code, message, Base) {
|
||||
if (!Base) {
|
||||
Base = Error;
|
||||
}
|
||||
|
||||
function getMessage(arg1, arg2, arg3) {
|
||||
if (typeof message === 'string') {
|
||||
return message;
|
||||
} else {
|
||||
return message(arg1, arg2, arg3);
|
||||
}
|
||||
}
|
||||
|
||||
var NodeError =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
_inheritsLoose(NodeError, _Base);
|
||||
|
||||
function NodeError(arg1, arg2, arg3) {
|
||||
return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
|
||||
}
|
||||
|
||||
return NodeError;
|
||||
}(Base);
|
||||
|
||||
NodeError.prototype.name = Base.name;
|
||||
NodeError.prototype.code = code;
|
||||
codes[code] = NodeError;
|
||||
} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
||||
|
||||
|
||||
function oneOf(expected, thing) {
|
||||
if (Array.isArray(expected)) {
|
||||
var len = expected.length;
|
||||
expected = expected.map(function (i) {
|
||||
return String(i);
|
||||
});
|
||||
|
||||
if (len > 2) {
|
||||
return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
|
||||
} else if (len === 2) {
|
||||
return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
|
||||
} else {
|
||||
return "of ".concat(thing, " ").concat(expected[0]);
|
||||
}
|
||||
} else {
|
||||
return "of ".concat(thing, " ").concat(String(expected));
|
||||
}
|
||||
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
||||
|
||||
|
||||
function startsWith(str, search, pos) {
|
||||
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
||||
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
||||
|
||||
|
||||
function endsWith(str, search, this_len) {
|
||||
if (this_len === undefined || this_len > str.length) {
|
||||
this_len = str.length;
|
||||
}
|
||||
|
||||
return str.substring(this_len - search.length, this_len) === search;
|
||||
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
||||
|
||||
|
||||
function includes(str, search, start) {
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > str.length) {
|
||||
return false;
|
||||
} else {
|
||||
return str.indexOf(search, start) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
||||
return 'The value "' + value + '" is invalid for option "' + name + '"';
|
||||
}, TypeError);
|
||||
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
||||
// determiner: 'must be' or 'must not be'
|
||||
var determiner;
|
||||
|
||||
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
||||
determiner = 'must not be';
|
||||
expected = expected.replace(/^not /, '');
|
||||
} else {
|
||||
determiner = 'must be';
|
||||
}
|
||||
|
||||
var msg;
|
||||
|
||||
if (endsWith(name, ' argument')) {
|
||||
// For cases like 'first argument'
|
||||
msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
||||
} else {
|
||||
var type = includes(name, '.') ? 'property' : 'argument';
|
||||
msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
||||
}
|
||||
|
||||
msg += ". Received type ".concat(typeof actual);
|
||||
return msg;
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
||||
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
||||
return 'The ' + name + ' method is not implemented';
|
||||
});
|
||||
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
||||
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
||||
return 'Cannot call ' + name + ' after a stream was destroyed';
|
||||
});
|
||||
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
||||
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
||||
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
||||
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
||||
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
||||
return 'Unknown encoding: ' + arg;
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
||||
module.exports.codes = codes;
|
116
node_modules/spdy-transport/node_modules/readable-stream/errors.js
generated
vendored
Normal file
116
node_modules/spdy-transport/node_modules/readable-stream/errors.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
|
||||
const codes = {};
|
||||
|
||||
function createErrorType(code, message, Base) {
|
||||
if (!Base) {
|
||||
Base = Error
|
||||
}
|
||||
|
||||
function getMessage (arg1, arg2, arg3) {
|
||||
if (typeof message === 'string') {
|
||||
return message
|
||||
} else {
|
||||
return message(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
class NodeError extends Base {
|
||||
constructor (arg1, arg2, arg3) {
|
||||
super(getMessage(arg1, arg2, arg3));
|
||||
}
|
||||
}
|
||||
|
||||
NodeError.prototype.name = Base.name;
|
||||
NodeError.prototype.code = code;
|
||||
|
||||
codes[code] = NodeError;
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
||||
function oneOf(expected, thing) {
|
||||
if (Array.isArray(expected)) {
|
||||
const len = expected.length;
|
||||
expected = expected.map((i) => String(i));
|
||||
if (len > 2) {
|
||||
return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
|
||||
expected[len - 1];
|
||||
} else if (len === 2) {
|
||||
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
|
||||
} else {
|
||||
return `of ${thing} ${expected[0]}`;
|
||||
}
|
||||
} else {
|
||||
return `of ${thing} ${String(expected)}`;
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
||||
function startsWith(str, search, pos) {
|
||||
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
||||
function endsWith(str, search, this_len) {
|
||||
if (this_len === undefined || this_len > str.length) {
|
||||
this_len = str.length;
|
||||
}
|
||||
return str.substring(this_len - search.length, this_len) === search;
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
||||
function includes(str, search, start) {
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > str.length) {
|
||||
return false;
|
||||
} else {
|
||||
return str.indexOf(search, start) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
||||
return 'The value "' + value + '" is invalid for option "' + name + '"'
|
||||
}, TypeError);
|
||||
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
||||
// determiner: 'must be' or 'must not be'
|
||||
let determiner;
|
||||
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
||||
determiner = 'must not be';
|
||||
expected = expected.replace(/^not /, '');
|
||||
} else {
|
||||
determiner = 'must be';
|
||||
}
|
||||
|
||||
let msg;
|
||||
if (endsWith(name, ' argument')) {
|
||||
// For cases like 'first argument'
|
||||
msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
|
||||
} else {
|
||||
const type = includes(name, '.') ? 'property' : 'argument';
|
||||
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
|
||||
}
|
||||
|
||||
msg += `. Received type ${typeof actual}`;
|
||||
return msg;
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
||||
createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
||||
return 'The ' + name + ' method is not implemented'
|
||||
});
|
||||
createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
||||
createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
||||
return 'Cannot call ' + name + ' after a stream was destroyed';
|
||||
});
|
||||
createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
||||
createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
||||
createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
||||
createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
||||
createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
||||
return 'Unknown encoding: ' + arg
|
||||
}, TypeError);
|
||||
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
||||
|
||||
module.exports.codes = codes;
|
17
node_modules/spdy-transport/node_modules/readable-stream/experimentalWarning.js
generated
vendored
Normal file
17
node_modules/spdy-transport/node_modules/readable-stream/experimentalWarning.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
var experimentalWarnings = new Set();
|
||||
|
||||
function emitExperimentalWarning(feature) {
|
||||
if (experimentalWarnings.has(feature)) return;
|
||||
var msg = feature + ' is an experimental feature. This feature could ' +
|
||||
'change at any time';
|
||||
experimentalWarnings.add(feature);
|
||||
process.emitWarning(msg, 'ExperimentalWarning');
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
module.exports.emitExperimentalWarning = process.emitWarning
|
||||
? emitExperimentalWarning
|
||||
: noop;
|
139
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_duplex.js
generated
vendored
Normal file
139
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_duplex.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
// 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.
|
||||
// a duplex stream is just a stream that is both readable and writable.
|
||||
// Since JS doesn't have multiple prototypal inheritance, this class
|
||||
// prototypally inherits from Readable, and then parasitically from
|
||||
// Writable.
|
||||
'use strict';
|
||||
/*<replacement>*/
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var keys = [];
|
||||
|
||||
for (var key in obj) {
|
||||
keys.push(key);
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
module.exports = Duplex;
|
||||
|
||||
var Readable = require('./_stream_readable');
|
||||
|
||||
var Writable = require('./_stream_writable');
|
||||
|
||||
require('inherits')(Duplex, Readable);
|
||||
|
||||
{
|
||||
// Allow the keys array to be GC'ed.
|
||||
var keys = objectKeys(Writable.prototype);
|
||||
|
||||
for (var v = 0; v < keys.length; v++) {
|
||||
var method = keys[v];
|
||||
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
||||
}
|
||||
}
|
||||
|
||||
function Duplex(options) {
|
||||
if (!(this instanceof Duplex)) return new Duplex(options);
|
||||
Readable.call(this, options);
|
||||
Writable.call(this, options);
|
||||
this.allowHalfOpen = true;
|
||||
|
||||
if (options) {
|
||||
if (options.readable === false) this.readable = false;
|
||||
if (options.writable === false) this.writable = false;
|
||||
|
||||
if (options.allowHalfOpen === false) {
|
||||
this.allowHalfOpen = false;
|
||||
this.once('end', onend);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState.highWaterMark;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState && this._writableState.getBuffer();
|
||||
}
|
||||
});
|
||||
Object.defineProperty(Duplex.prototype, 'writableLength', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
return this._writableState.length;
|
||||
}
|
||||
}); // the no-half-open enforcer
|
||||
|
||||
function onend() {
|
||||
// If the writable side ended, then we're ok.
|
||||
if (this._writableState.ended) return; // no more data can be written.
|
||||
// But allow more writes to happen in this tick.
|
||||
|
||||
process.nextTick(onEndNT, this);
|
||||
}
|
||||
|
||||
function onEndNT(self) {
|
||||
self.end();
|
||||
}
|
||||
|
||||
Object.defineProperty(Duplex.prototype, 'destroyed', {
|
||||
// making it explicit this property is not enumerable
|
||||
// because otherwise some prototype manipulation in
|
||||
// userland will fail
|
||||
enumerable: false,
|
||||
get: function get() {
|
||||
if (this._readableState === undefined || this._writableState === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this._readableState.destroyed && this._writableState.destroyed;
|
||||
},
|
||||
set: function set(value) {
|
||||
// we ignore the value if the stream
|
||||
// has not been initialized yet
|
||||
if (this._readableState === undefined || this._writableState === undefined) {
|
||||
return;
|
||||
} // backward compatibility, the user is explicitly
|
||||
// managing destroyed
|
||||
|
||||
|
||||
this._readableState.destroyed = value;
|
||||
this._writableState.destroyed = value;
|
||||
}
|
||||
});
|
39
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_passthrough.js
generated
vendored
Normal file
39
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_passthrough.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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.
|
||||
// a passthrough stream.
|
||||
// basically just the most minimal sort of Transform stream.
|
||||
// Every written chunk gets output as-is.
|
||||
'use strict';
|
||||
|
||||
module.exports = PassThrough;
|
||||
|
||||
var Transform = require('./_stream_transform');
|
||||
|
||||
require('inherits')(PassThrough, Transform);
|
||||
|
||||
function PassThrough(options) {
|
||||
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
||||
cb(null, chunk);
|
||||
};
|
1124
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_readable.js
generated
vendored
Normal file
1124
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_readable.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
201
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_transform.js
generated
vendored
Normal file
201
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_transform.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
// 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.
|
||||
// a transform stream is a readable/writable stream where you do
|
||||
// something with the data. Sometimes it's called a "filter",
|
||||
// but that's not a great name for it, since that implies a thing where
|
||||
// some bits pass through, and others are simply ignored. (That would
|
||||
// be a valid example of a transform, of course.)
|
||||
//
|
||||
// While the output is causally related to the input, it's not a
|
||||
// necessarily symmetric or synchronous transformation. For example,
|
||||
// a zlib stream might take multiple plain-text writes(), and then
|
||||
// emit a single compressed chunk some time in the future.
|
||||
//
|
||||
// Here's how this works:
|
||||
//
|
||||
// The Transform stream has all the aspects of the readable and writable
|
||||
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
||||
// internally, and returns false if there's a lot of pending writes
|
||||
// buffered up. When you call read(), that calls _read(n) until
|
||||
// there's enough pending readable data buffered up.
|
||||
//
|
||||
// In a transform stream, the written data is placed in a buffer. When
|
||||
// _read(n) is called, it transforms the queued up data, calling the
|
||||
// buffered _write cb's as it consumes chunks. If consuming a single
|
||||
// written chunk would result in multiple output chunks, then the first
|
||||
// outputted bit calls the readcb, and subsequent chunks just go into
|
||||
// the read buffer, and will cause it to emit 'readable' if necessary.
|
||||
//
|
||||
// This way, back-pressure is actually determined by the reading side,
|
||||
// since _read has to be called to start processing a new chunk. However,
|
||||
// a pathological inflate type of transform can cause excessive buffering
|
||||
// here. For example, imagine a stream where every byte of input is
|
||||
// interpreted as an integer from 0-255, and then results in that many
|
||||
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
||||
// 1kb of data being output. In this case, you could write a very small
|
||||
// amount of input, and end up with a very large amount of output. In
|
||||
// such a pathological inflating mechanism, there'd be no way to tell
|
||||
// the system to stop doing the transform. A single 4MB write could
|
||||
// cause the system to run out of memory.
|
||||
//
|
||||
// However, even in such a pathological case, only a single written chunk
|
||||
// would be consumed, and then the rest would wait (un-transformed) until
|
||||
// the results of the previous transformed chunk were consumed.
|
||||
'use strict';
|
||||
|
||||
module.exports = Transform;
|
||||
|
||||
var _require$codes = require('../errors').codes,
|
||||
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
||||
ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
||||
ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
|
||||
ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
|
||||
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
require('inherits')(Transform, Duplex);
|
||||
|
||||
function afterTransform(er, data) {
|
||||
var ts = this._transformState;
|
||||
ts.transforming = false;
|
||||
var cb = ts.writecb;
|
||||
|
||||
if (cb === null) {
|
||||
return this.emit('error', new ERR_MULTIPLE_CALLBACK());
|
||||
}
|
||||
|
||||
ts.writechunk = null;
|
||||
ts.writecb = null;
|
||||
if (data != null) // single equals check for both `null` and `undefined`
|
||||
this.push(data);
|
||||
cb(er);
|
||||
var rs = this._readableState;
|
||||
rs.reading = false;
|
||||
|
||||
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
||||
this._read(rs.highWaterMark);
|
||||
}
|
||||
}
|
||||
|
||||
function Transform(options) {
|
||||
if (!(this instanceof Transform)) return new Transform(options);
|
||||
Duplex.call(this, options);
|
||||
this._transformState = {
|
||||
afterTransform: afterTransform.bind(this),
|
||||
needTransform: false,
|
||||
transforming: false,
|
||||
writecb: null,
|
||||
writechunk: null,
|
||||
writeencoding: null
|
||||
}; // start out asking for a readable event once data is transformed.
|
||||
|
||||
this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
|
||||
// that Readable wants before the first _read call, so unset the
|
||||
// sync guard flag.
|
||||
|
||||
this._readableState.sync = false;
|
||||
|
||||
if (options) {
|
||||
if (typeof options.transform === 'function') this._transform = options.transform;
|
||||
if (typeof options.flush === 'function') this._flush = options.flush;
|
||||
} // When the writable side finishes, then flush out anything remaining.
|
||||
|
||||
|
||||
this.on('prefinish', prefinish);
|
||||
}
|
||||
|
||||
function prefinish() {
|
||||
var _this = this;
|
||||
|
||||
if (typeof this._flush === 'function' && !this._readableState.destroyed) {
|
||||
this._flush(function (er, data) {
|
||||
done(_this, er, data);
|
||||
});
|
||||
} else {
|
||||
done(this, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
Transform.prototype.push = function (chunk, encoding) {
|
||||
this._transformState.needTransform = false;
|
||||
return Duplex.prototype.push.call(this, chunk, encoding);
|
||||
}; // This is the part where you do stuff!
|
||||
// override this function in implementation classes.
|
||||
// 'chunk' is an input chunk.
|
||||
//
|
||||
// Call `push(newChunk)` to pass along transformed output
|
||||
// to the readable side. You may call 'push' zero or more times.
|
||||
//
|
||||
// Call `cb(err)` when you are done with this chunk. If you pass
|
||||
// an error, then that'll put the hurt on the whole operation. If you
|
||||
// never call cb(), then you'll never get another chunk.
|
||||
|
||||
|
||||
Transform.prototype._transform = function (chunk, encoding, cb) {
|
||||
cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
|
||||
};
|
||||
|
||||
Transform.prototype._write = function (chunk, encoding, cb) {
|
||||
var ts = this._transformState;
|
||||
ts.writecb = cb;
|
||||
ts.writechunk = chunk;
|
||||
ts.writeencoding = encoding;
|
||||
|
||||
if (!ts.transforming) {
|
||||
var rs = this._readableState;
|
||||
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
||||
}
|
||||
}; // Doesn't matter what the args are here.
|
||||
// _transform does all the work.
|
||||
// That we got here means that the readable side wants more data.
|
||||
|
||||
|
||||
Transform.prototype._read = function (n) {
|
||||
var ts = this._transformState;
|
||||
|
||||
if (ts.writechunk !== null && !ts.transforming) {
|
||||
ts.transforming = true;
|
||||
|
||||
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
||||
} else {
|
||||
// mark that we need a transform, so that any data that comes in
|
||||
// will get processed, now that we've asked for it.
|
||||
ts.needTransform = true;
|
||||
}
|
||||
};
|
||||
|
||||
Transform.prototype._destroy = function (err, cb) {
|
||||
Duplex.prototype._destroy.call(this, err, function (err2) {
|
||||
cb(err2);
|
||||
});
|
||||
};
|
||||
|
||||
function done(stream, er, data) {
|
||||
if (er) return stream.emit('error', er);
|
||||
if (data != null) // single equals check for both `null` and `undefined`
|
||||
stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
|
||||
// if there's nothing in the write buffer, then that means
|
||||
// that nothing more will ever be provided
|
||||
|
||||
if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
|
||||
if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
||||
return stream.push(null);
|
||||
}
|
697
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js
generated
vendored
Normal file
697
node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user