isomorfeus-puppetmaster 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/puppetmaster/version.rb +1 -1
- data/node_modules/.package-lock.json +56 -45
- data/node_modules/debug/package.json +1 -1
- data/node_modules/debug/src/common.js +14 -1
- data/node_modules/{mkdirp → mkdirp-classic}/LICENSE +2 -2
- data/node_modules/mkdirp-classic/README.md +18 -0
- data/node_modules/{mkdirp → mkdirp-classic}/index.js +2 -3
- data/node_modules/mkdirp-classic/package.json +18 -0
- data/node_modules/node-fetch/lib/index.es.js +25 -3
- data/node_modules/node-fetch/lib/index.js +25 -3
- data/node_modules/node-fetch/lib/index.mjs +25 -3
- data/node_modules/node-fetch/package.json +8 -6
- data/node_modules/progress/lib/node-progress.js +4 -3
- data/node_modules/progress/package.json +1 -1
- data/node_modules/puppeteer-core/CHANGELOG.md +29 -0
- data/node_modules/puppeteer-core/README.md +12 -14
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts +2 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js +13 -5
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js +2 -2
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts +7 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js +25 -7
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js +6 -6
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts +3 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js +16 -12
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js +2 -2
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts +10 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js +9 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js +8 -8
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js +2 -2
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts +21 -9
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js +155 -72
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts +5 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js +32 -29
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js +14 -4
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts +2 -3
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js +3 -4
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts +3 -3
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js +13 -12
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js +2 -5
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts +33 -4
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js +92 -46
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js +5 -5
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts +3 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js +3 -2
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.d.ts +21 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.js +30 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TaskQueue.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js +5 -5
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js +14 -14
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js +11 -5
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts +4 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js +30 -15
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js +2 -2
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js.map +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js +1 -1
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts +2 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js +9 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts +7 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js +22 -4
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts +3 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js +6 -2
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts +10 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js +7 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts +21 -9
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js +150 -67
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts +5 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js +22 -19
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js +14 -4
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts +2 -3
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js +2 -3
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts +3 -3
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js +2 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js +1 -4
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts +33 -4
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js +69 -23
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts +3 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js +3 -2
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.d.ts +21 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.js +26 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TaskQueue.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js +7 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts +4 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js +27 -12
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js.map +1 -1
- data/node_modules/puppeteer-core/lib/types.d.ts +3848 -3757
- data/node_modules/puppeteer-core/package.json +33 -40
- data/node_modules/tar-fs/.travis.yml +2 -1
- data/node_modules/tar-fs/README.md +4 -2
- data/node_modules/tar-fs/index.js +11 -8
- data/node_modules/tar-fs/package.json +4 -4
- data/node_modules/tar-fs/test/index.js +1 -1
- data/node_modules/tr46/.npmignore +4 -0
- data/node_modules/tr46/index.js +193 -0
- data/node_modules/tr46/lib/.gitkeep +0 -0
- data/node_modules/tr46/lib/mappingTable.json +1 -0
- data/node_modules/tr46/package.json +31 -0
- data/node_modules/unbzip2-stream/README.md +1 -1
- data/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js +1 -1
- data/node_modules/unbzip2-stream/index.js +3 -2
- data/node_modules/unbzip2-stream/lib/bzip2.js +4 -6
- data/node_modules/unbzip2-stream/package.json +1 -1
- data/node_modules/webidl-conversions/LICENSE.md +12 -0
- data/node_modules/webidl-conversions/README.md +53 -0
- data/node_modules/webidl-conversions/lib/index.js +189 -0
- data/node_modules/webidl-conversions/package.json +23 -0
- data/node_modules/whatwg-url/LICENSE.txt +21 -0
- data/node_modules/whatwg-url/README.md +67 -0
- data/node_modules/whatwg-url/lib/URL-impl.js +200 -0
- data/node_modules/whatwg-url/lib/URL.js +196 -0
- data/node_modules/whatwg-url/lib/public-api.js +11 -0
- data/node_modules/whatwg-url/lib/url-state-machine.js +1297 -0
- data/node_modules/whatwg-url/lib/utils.js +20 -0
- data/node_modules/whatwg-url/package.json +32 -0
- data/node_modules/ws/LICENSE +0 -2
- data/node_modules/ws/README.md +49 -52
- data/node_modules/ws/index.js +3 -0
- data/node_modules/ws/lib/buffer-util.js +3 -6
- data/node_modules/ws/lib/constants.js +3 -1
- data/node_modules/ws/lib/event-target.js +172 -90
- data/node_modules/ws/lib/extension.js +8 -28
- data/node_modules/ws/lib/permessage-deflate.js +10 -16
- data/node_modules/ws/lib/receiver.js +143 -38
- data/node_modules/ws/lib/sender.js +29 -12
- data/node_modules/ws/lib/stream.js +20 -5
- data/node_modules/ws/lib/subprotocol.js +62 -0
- data/node_modules/ws/lib/validation.js +28 -8
- data/node_modules/ws/lib/websocket-server.js +129 -62
- data/node_modules/ws/lib/websocket.js +311 -104
- data/node_modules/ws/package.json +10 -5
- data/node_modules/ws/wrapper.mjs +8 -0
- data/package.json +1 -1
- metadata +39 -39
- data/node_modules/.bin/mkdirp +0 -12
- data/node_modules/.bin/mkdirp.cmd +0 -17
- data/node_modules/.bin/mkdirp.ps1 +0 -28
- data/node_modules/minimist/.travis.yml +0 -8
- data/node_modules/minimist/LICENSE +0 -18
- data/node_modules/minimist/example/parse.js +0 -2
- data/node_modules/minimist/index.js +0 -245
- data/node_modules/minimist/package.json +0 -45
- data/node_modules/minimist/readme.markdown +0 -95
- data/node_modules/minimist/test/all_bool.js +0 -32
- data/node_modules/minimist/test/bool.js +0 -178
- data/node_modules/minimist/test/dash.js +0 -31
- data/node_modules/minimist/test/default_bool.js +0 -35
- data/node_modules/minimist/test/dotted.js +0 -22
- data/node_modules/minimist/test/kv_short.js +0 -16
- data/node_modules/minimist/test/long.js +0 -31
- data/node_modules/minimist/test/num.js +0 -36
- data/node_modules/minimist/test/parse.js +0 -197
- data/node_modules/minimist/test/parse_modified.js +0 -9
- data/node_modules/minimist/test/proto.js +0 -44
- data/node_modules/minimist/test/short.js +0 -67
- data/node_modules/minimist/test/stop_early.js +0 -15
- data/node_modules/minimist/test/unknown.js +0 -102
- data/node_modules/minimist/test/whitespace.js +0 -8
- data/node_modules/mkdirp/bin/cmd.js +0 -33
- data/node_modules/mkdirp/bin/usage.txt +0 -12
- data/node_modules/mkdirp/package.json +0 -34
- data/node_modules/mkdirp/readme.markdown +0 -100
- data/node_modules/node-fetch/CHANGELOG.md +0 -272
@@ -22,26 +22,31 @@ const INFLATING = 5;
|
|
22
22
|
/**
|
23
23
|
* HyBi Receiver implementation.
|
24
24
|
*
|
25
|
-
* @extends
|
25
|
+
* @extends Writable
|
26
26
|
*/
|
27
27
|
class Receiver extends Writable {
|
28
28
|
/**
|
29
29
|
* Creates a Receiver instance.
|
30
30
|
*
|
31
|
-
* @param {
|
32
|
-
* @param {
|
33
|
-
* @param {
|
34
|
-
*
|
35
|
-
* @param {
|
31
|
+
* @param {Object} [options] Options object
|
32
|
+
* @param {String} [options.binaryType=nodebuffer] The type for binary data
|
33
|
+
* @param {Object} [options.extensions] An object containing the negotiated
|
34
|
+
* extensions
|
35
|
+
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
36
|
+
* client or server mode
|
37
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
38
|
+
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
39
|
+
* not to skip UTF-8 validation for text and close messages
|
36
40
|
*/
|
37
|
-
constructor(
|
41
|
+
constructor(options = {}) {
|
38
42
|
super();
|
39
43
|
|
40
|
-
this._binaryType = binaryType || BINARY_TYPES[0];
|
44
|
+
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
45
|
+
this._extensions = options.extensions || {};
|
46
|
+
this._isServer = !!options.isServer;
|
47
|
+
this._maxPayload = options.maxPayload | 0;
|
48
|
+
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
41
49
|
this[kWebSocket] = undefined;
|
42
|
-
this._extensions = extensions || {};
|
43
|
-
this._isServer = !!isServer;
|
44
|
-
this._maxPayload = maxPayload | 0;
|
45
50
|
|
46
51
|
this._bufferedBytes = 0;
|
47
52
|
this._buffers = [];
|
@@ -168,14 +173,26 @@ class Receiver extends Writable {
|
|
168
173
|
|
169
174
|
if ((buf[0] & 0x30) !== 0x00) {
|
170
175
|
this._loop = false;
|
171
|
-
return error(
|
176
|
+
return error(
|
177
|
+
RangeError,
|
178
|
+
'RSV2 and RSV3 must be clear',
|
179
|
+
true,
|
180
|
+
1002,
|
181
|
+
'WS_ERR_UNEXPECTED_RSV_2_3'
|
182
|
+
);
|
172
183
|
}
|
173
184
|
|
174
185
|
const compressed = (buf[0] & 0x40) === 0x40;
|
175
186
|
|
176
187
|
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
177
188
|
this._loop = false;
|
178
|
-
return error(
|
189
|
+
return error(
|
190
|
+
RangeError,
|
191
|
+
'RSV1 must be clear',
|
192
|
+
true,
|
193
|
+
1002,
|
194
|
+
'WS_ERR_UNEXPECTED_RSV_1'
|
195
|
+
);
|
179
196
|
}
|
180
197
|
|
181
198
|
this._fin = (buf[0] & 0x80) === 0x80;
|
@@ -185,31 +202,61 @@ class Receiver extends Writable {
|
|
185
202
|
if (this._opcode === 0x00) {
|
186
203
|
if (compressed) {
|
187
204
|
this._loop = false;
|
188
|
-
return error(
|
205
|
+
return error(
|
206
|
+
RangeError,
|
207
|
+
'RSV1 must be clear',
|
208
|
+
true,
|
209
|
+
1002,
|
210
|
+
'WS_ERR_UNEXPECTED_RSV_1'
|
211
|
+
);
|
189
212
|
}
|
190
213
|
|
191
214
|
if (!this._fragmented) {
|
192
215
|
this._loop = false;
|
193
|
-
return error(
|
216
|
+
return error(
|
217
|
+
RangeError,
|
218
|
+
'invalid opcode 0',
|
219
|
+
true,
|
220
|
+
1002,
|
221
|
+
'WS_ERR_INVALID_OPCODE'
|
222
|
+
);
|
194
223
|
}
|
195
224
|
|
196
225
|
this._opcode = this._fragmented;
|
197
226
|
} else if (this._opcode === 0x01 || this._opcode === 0x02) {
|
198
227
|
if (this._fragmented) {
|
199
228
|
this._loop = false;
|
200
|
-
return error(
|
229
|
+
return error(
|
230
|
+
RangeError,
|
231
|
+
`invalid opcode ${this._opcode}`,
|
232
|
+
true,
|
233
|
+
1002,
|
234
|
+
'WS_ERR_INVALID_OPCODE'
|
235
|
+
);
|
201
236
|
}
|
202
237
|
|
203
238
|
this._compressed = compressed;
|
204
239
|
} else if (this._opcode > 0x07 && this._opcode < 0x0b) {
|
205
240
|
if (!this._fin) {
|
206
241
|
this._loop = false;
|
207
|
-
return error(
|
242
|
+
return error(
|
243
|
+
RangeError,
|
244
|
+
'FIN must be set',
|
245
|
+
true,
|
246
|
+
1002,
|
247
|
+
'WS_ERR_EXPECTED_FIN'
|
248
|
+
);
|
208
249
|
}
|
209
250
|
|
210
251
|
if (compressed) {
|
211
252
|
this._loop = false;
|
212
|
-
return error(
|
253
|
+
return error(
|
254
|
+
RangeError,
|
255
|
+
'RSV1 must be clear',
|
256
|
+
true,
|
257
|
+
1002,
|
258
|
+
'WS_ERR_UNEXPECTED_RSV_1'
|
259
|
+
);
|
213
260
|
}
|
214
261
|
|
215
262
|
if (this._payloadLength > 0x7d) {
|
@@ -218,12 +265,19 @@ class Receiver extends Writable {
|
|
218
265
|
RangeError,
|
219
266
|
`invalid payload length ${this._payloadLength}`,
|
220
267
|
true,
|
221
|
-
1002
|
268
|
+
1002,
|
269
|
+
'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
|
222
270
|
);
|
223
271
|
}
|
224
272
|
} else {
|
225
273
|
this._loop = false;
|
226
|
-
return error(
|
274
|
+
return error(
|
275
|
+
RangeError,
|
276
|
+
`invalid opcode ${this._opcode}`,
|
277
|
+
true,
|
278
|
+
1002,
|
279
|
+
'WS_ERR_INVALID_OPCODE'
|
280
|
+
);
|
227
281
|
}
|
228
282
|
|
229
283
|
if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
|
@@ -232,11 +286,23 @@ class Receiver extends Writable {
|
|
232
286
|
if (this._isServer) {
|
233
287
|
if (!this._masked) {
|
234
288
|
this._loop = false;
|
235
|
-
return error(
|
289
|
+
return error(
|
290
|
+
RangeError,
|
291
|
+
'MASK must be set',
|
292
|
+
true,
|
293
|
+
1002,
|
294
|
+
'WS_ERR_EXPECTED_MASK'
|
295
|
+
);
|
236
296
|
}
|
237
297
|
} else if (this._masked) {
|
238
298
|
this._loop = false;
|
239
|
-
return error(
|
299
|
+
return error(
|
300
|
+
RangeError,
|
301
|
+
'MASK must be clear',
|
302
|
+
true,
|
303
|
+
1002,
|
304
|
+
'WS_ERR_UNEXPECTED_MASK'
|
305
|
+
);
|
240
306
|
}
|
241
307
|
|
242
308
|
if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
|
@@ -285,7 +351,8 @@ class Receiver extends Writable {
|
|
285
351
|
RangeError,
|
286
352
|
'Unsupported WebSocket frame: payload length > 2^53 - 1',
|
287
353
|
false,
|
288
|
-
1009
|
354
|
+
1009,
|
355
|
+
'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'
|
289
356
|
);
|
290
357
|
}
|
291
358
|
|
@@ -304,7 +371,13 @@ class Receiver extends Writable {
|
|
304
371
|
this._totalPayloadLength += this._payloadLength;
|
305
372
|
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
306
373
|
this._loop = false;
|
307
|
-
return error(
|
374
|
+
return error(
|
375
|
+
RangeError,
|
376
|
+
'Max payload size exceeded',
|
377
|
+
false,
|
378
|
+
1009,
|
379
|
+
'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
|
380
|
+
);
|
308
381
|
}
|
309
382
|
}
|
310
383
|
|
@@ -357,7 +430,7 @@ class Receiver extends Writable {
|
|
357
430
|
|
358
431
|
if (data.length) {
|
359
432
|
//
|
360
|
-
// This message is not compressed so its
|
433
|
+
// This message is not compressed so its length is the sum of the payload
|
361
434
|
// length of all fragments.
|
362
435
|
//
|
363
436
|
this._messageLength = this._totalPayloadLength;
|
@@ -384,7 +457,13 @@ class Receiver extends Writable {
|
|
384
457
|
this._messageLength += buf.length;
|
385
458
|
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
386
459
|
return cb(
|
387
|
-
error(
|
460
|
+
error(
|
461
|
+
RangeError,
|
462
|
+
'Max payload size exceeded',
|
463
|
+
false,
|
464
|
+
1009,
|
465
|
+
'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
|
466
|
+
)
|
388
467
|
);
|
389
468
|
}
|
390
469
|
|
@@ -425,16 +504,22 @@ class Receiver extends Writable {
|
|
425
504
|
data = fragments;
|
426
505
|
}
|
427
506
|
|
428
|
-
this.emit('message', data);
|
507
|
+
this.emit('message', data, true);
|
429
508
|
} else {
|
430
509
|
const buf = concat(fragments, messageLength);
|
431
510
|
|
432
|
-
if (!isValidUTF8(buf)) {
|
511
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
433
512
|
this._loop = false;
|
434
|
-
return error(
|
513
|
+
return error(
|
514
|
+
Error,
|
515
|
+
'invalid UTF-8 sequence',
|
516
|
+
true,
|
517
|
+
1007,
|
518
|
+
'WS_ERR_INVALID_UTF8'
|
519
|
+
);
|
435
520
|
}
|
436
521
|
|
437
|
-
this.emit('message', buf
|
522
|
+
this.emit('message', buf, false);
|
438
523
|
}
|
439
524
|
}
|
440
525
|
|
@@ -453,24 +538,42 @@ class Receiver extends Writable {
|
|
453
538
|
this._loop = false;
|
454
539
|
|
455
540
|
if (data.length === 0) {
|
456
|
-
this.emit('conclude', 1005,
|
541
|
+
this.emit('conclude', 1005, EMPTY_BUFFER);
|
457
542
|
this.end();
|
458
543
|
} else if (data.length === 1) {
|
459
|
-
return error(
|
544
|
+
return error(
|
545
|
+
RangeError,
|
546
|
+
'invalid payload length 1',
|
547
|
+
true,
|
548
|
+
1002,
|
549
|
+
'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
|
550
|
+
);
|
460
551
|
} else {
|
461
552
|
const code = data.readUInt16BE(0);
|
462
553
|
|
463
554
|
if (!isValidStatusCode(code)) {
|
464
|
-
return error(
|
555
|
+
return error(
|
556
|
+
RangeError,
|
557
|
+
`invalid status code ${code}`,
|
558
|
+
true,
|
559
|
+
1002,
|
560
|
+
'WS_ERR_INVALID_CLOSE_CODE'
|
561
|
+
);
|
465
562
|
}
|
466
563
|
|
467
564
|
const buf = data.slice(2);
|
468
565
|
|
469
|
-
if (!isValidUTF8(buf)) {
|
470
|
-
return error(
|
566
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
567
|
+
return error(
|
568
|
+
Error,
|
569
|
+
'invalid UTF-8 sequence',
|
570
|
+
true,
|
571
|
+
1007,
|
572
|
+
'WS_ERR_INVALID_UTF8'
|
573
|
+
);
|
471
574
|
}
|
472
575
|
|
473
|
-
this.emit('conclude', code, buf
|
576
|
+
this.emit('conclude', code, buf);
|
474
577
|
this.end();
|
475
578
|
}
|
476
579
|
} else if (this._opcode === 0x09) {
|
@@ -488,20 +591,22 @@ module.exports = Receiver;
|
|
488
591
|
/**
|
489
592
|
* Builds an error object.
|
490
593
|
*
|
491
|
-
* @param {(Error|RangeError)} ErrorCtor The error constructor
|
594
|
+
* @param {function(new:Error|RangeError)} ErrorCtor The error constructor
|
492
595
|
* @param {String} message The error message
|
493
596
|
* @param {Boolean} prefix Specifies whether or not to add a default prefix to
|
494
597
|
* `message`
|
495
598
|
* @param {Number} statusCode The status code
|
599
|
+
* @param {String} errorCode The exposed error code
|
496
600
|
* @return {(Error|RangeError)} The error
|
497
601
|
* @private
|
498
602
|
*/
|
499
|
-
function error(ErrorCtor, message, prefix, statusCode) {
|
603
|
+
function error(ErrorCtor, message, prefix, statusCode, errorCode) {
|
500
604
|
const err = new ErrorCtor(
|
501
605
|
prefix ? `Invalid WebSocket frame: ${message}` : message
|
502
606
|
);
|
503
607
|
|
504
608
|
Error.captureStackTrace(err, error);
|
609
|
+
err.code = errorCode;
|
505
610
|
err[kStatusCode] = statusCode;
|
506
611
|
return err;
|
507
612
|
}
|
@@ -1,5 +1,9 @@
|
|
1
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^net|tls$" }] */
|
2
|
+
|
1
3
|
'use strict';
|
2
4
|
|
5
|
+
const net = require('net');
|
6
|
+
const tls = require('tls');
|
3
7
|
const { randomFillSync } = require('crypto');
|
4
8
|
|
5
9
|
const PerMessageDeflate = require('./permessage-deflate');
|
@@ -16,7 +20,7 @@ class Sender {
|
|
16
20
|
/**
|
17
21
|
* Creates a Sender instance.
|
18
22
|
*
|
19
|
-
* @param {net.Socket} socket The connection socket
|
23
|
+
* @param {(net.Socket|tls.Socket)} socket The connection socket
|
20
24
|
* @param {Object} [extensions] An object containing the negotiated extensions
|
21
25
|
*/
|
22
26
|
constructor(socket, extensions) {
|
@@ -36,13 +40,13 @@ class Sender {
|
|
36
40
|
*
|
37
41
|
* @param {Buffer} data The data to frame
|
38
42
|
* @param {Object} options Options object
|
39
|
-
* @param {Number} options.opcode The opcode
|
40
|
-
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
41
|
-
* modified
|
42
43
|
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
43
44
|
* FIN bit
|
44
45
|
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
45
46
|
* `data`
|
47
|
+
* @param {Number} options.opcode The opcode
|
48
|
+
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
49
|
+
* modified
|
46
50
|
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
47
51
|
* RSV1 bit
|
48
52
|
* @return {Buffer[]} The framed data as a list of `Buffer` instances
|
@@ -98,7 +102,7 @@ class Sender {
|
|
98
102
|
* Sends a close message to the other peer.
|
99
103
|
*
|
100
104
|
* @param {Number} [code] The status code component of the body
|
101
|
-
* @param {String} [data] The message component of the body
|
105
|
+
* @param {(String|Buffer)} [data] The message component of the body
|
102
106
|
* @param {Boolean} [mask=false] Specifies whether or not to mask the message
|
103
107
|
* @param {Function} [cb] Callback
|
104
108
|
* @public
|
@@ -110,7 +114,7 @@ class Sender {
|
|
110
114
|
buf = EMPTY_BUFFER;
|
111
115
|
} else if (typeof code !== 'number' || !isValidStatusCode(code)) {
|
112
116
|
throw new TypeError('First argument must be a valid error code number');
|
113
|
-
} else if (data === undefined || data
|
117
|
+
} else if (data === undefined || !data.length) {
|
114
118
|
buf = Buffer.allocUnsafe(2);
|
115
119
|
buf.writeUInt16BE(code, 0);
|
116
120
|
} else {
|
@@ -122,7 +126,12 @@ class Sender {
|
|
122
126
|
|
123
127
|
buf = Buffer.allocUnsafe(2 + length);
|
124
128
|
buf.writeUInt16BE(code, 0);
|
125
|
-
|
129
|
+
|
130
|
+
if (typeof data === 'string') {
|
131
|
+
buf.write(data, 2);
|
132
|
+
} else {
|
133
|
+
buf.set(data, 2);
|
134
|
+
}
|
126
135
|
}
|
127
136
|
|
128
137
|
if (this._deflating) {
|
@@ -246,10 +255,10 @@ class Sender {
|
|
246
255
|
*
|
247
256
|
* @param {*} data The message to send
|
248
257
|
* @param {Object} options Options object
|
249
|
-
* @param {Boolean} [options.compress=false] Specifies whether or not to
|
250
|
-
* compress `data`
|
251
258
|
* @param {Boolean} [options.binary=false] Specifies whether `data` is binary
|
252
259
|
* or text
|
260
|
+
* @param {Boolean} [options.compress=false] Specifies whether or not to
|
261
|
+
* compress `data`
|
253
262
|
* @param {Boolean} [options.fin=false] Specifies whether the fragment is the
|
254
263
|
* last one
|
255
264
|
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
@@ -265,7 +274,15 @@ class Sender {
|
|
265
274
|
|
266
275
|
if (this._firstFragment) {
|
267
276
|
this._firstFragment = false;
|
268
|
-
if (
|
277
|
+
if (
|
278
|
+
rsv1 &&
|
279
|
+
perMessageDeflate &&
|
280
|
+
perMessageDeflate.params[
|
281
|
+
perMessageDeflate._isServer
|
282
|
+
? 'server_no_context_takeover'
|
283
|
+
: 'client_no_context_takeover'
|
284
|
+
]
|
285
|
+
) {
|
269
286
|
rsv1 = buf.length >= perMessageDeflate._threshold;
|
270
287
|
}
|
271
288
|
this._compress = rsv1;
|
@@ -312,12 +329,12 @@ class Sender {
|
|
312
329
|
* `data`
|
313
330
|
* @param {Object} options Options object
|
314
331
|
* @param {Number} options.opcode The opcode
|
315
|
-
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
316
|
-
* modified
|
317
332
|
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
318
333
|
* FIN bit
|
319
334
|
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
320
335
|
* `data`
|
336
|
+
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
337
|
+
* modified
|
321
338
|
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
322
339
|
* RSV1 bit
|
323
340
|
* @param {Function} [cb] Callback
|
@@ -5,7 +5,7 @@ const { Duplex } = require('stream');
|
|
5
5
|
/**
|
6
6
|
* Emits the `'close'` event on a stream.
|
7
7
|
*
|
8
|
-
* @param {
|
8
|
+
* @param {Duplex} stream The stream.
|
9
9
|
* @private
|
10
10
|
*/
|
11
11
|
function emitClose(stream) {
|
@@ -43,11 +43,12 @@ function duplexOnError(err) {
|
|
43
43
|
*
|
44
44
|
* @param {WebSocket} ws The `WebSocket` to wrap
|
45
45
|
* @param {Object} [options] The options for the `Duplex` constructor
|
46
|
-
* @return {
|
46
|
+
* @return {Duplex} The duplex stream
|
47
47
|
* @public
|
48
48
|
*/
|
49
49
|
function createWebSocketStream(ws, options) {
|
50
50
|
let resumeOnReceiverDrain = true;
|
51
|
+
let terminateOnDestroy = true;
|
51
52
|
|
52
53
|
function receiverOnDrain() {
|
53
54
|
if (resumeOnReceiverDrain) ws._socket.resume();
|
@@ -71,8 +72,11 @@ function createWebSocketStream(ws, options) {
|
|
71
72
|
writableObjectMode: false
|
72
73
|
});
|
73
74
|
|
74
|
-
ws.on('message', function message(msg) {
|
75
|
-
|
75
|
+
ws.on('message', function message(msg, isBinary) {
|
76
|
+
const data =
|
77
|
+
!isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
78
|
+
|
79
|
+
if (!duplex.push(data)) {
|
76
80
|
resumeOnReceiverDrain = false;
|
77
81
|
ws._socket.pause();
|
78
82
|
}
|
@@ -81,6 +85,16 @@ function createWebSocketStream(ws, options) {
|
|
81
85
|
ws.once('error', function error(err) {
|
82
86
|
if (duplex.destroyed) return;
|
83
87
|
|
88
|
+
// Prevent `ws.terminate()` from being called by `duplex._destroy()`.
|
89
|
+
//
|
90
|
+
// - If the `'error'` event is emitted before the `'open'` event, then
|
91
|
+
// `ws.terminate()` is a noop as no socket is assigned.
|
92
|
+
// - Otherwise, the error is re-emitted by the listener of the `'error'`
|
93
|
+
// event of the `Receiver` object. The listener already closes the
|
94
|
+
// connection by calling `ws.close()`. This allows a close frame to be
|
95
|
+
// sent to the other peer. If `ws.terminate()` is called right after this,
|
96
|
+
// then the close frame might not be sent.
|
97
|
+
terminateOnDestroy = false;
|
84
98
|
duplex.destroy(err);
|
85
99
|
});
|
86
100
|
|
@@ -108,7 +122,8 @@ function createWebSocketStream(ws, options) {
|
|
108
122
|
if (!called) callback(err);
|
109
123
|
process.nextTick(emitClose, duplex);
|
110
124
|
});
|
111
|
-
|
125
|
+
|
126
|
+
if (terminateOnDestroy) ws.terminate();
|
112
127
|
};
|
113
128
|
|
114
129
|
duplex._final = function (callback) {
|
@@ -0,0 +1,62 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const { tokenChars } = require('./validation');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
|
7
|
+
*
|
8
|
+
* @param {String} header The field value of the header
|
9
|
+
* @return {Set} The subprotocol names
|
10
|
+
* @public
|
11
|
+
*/
|
12
|
+
function parse(header) {
|
13
|
+
const protocols = new Set();
|
14
|
+
let start = -1;
|
15
|
+
let end = -1;
|
16
|
+
let i = 0;
|
17
|
+
|
18
|
+
for (i; i < header.length; i++) {
|
19
|
+
const code = header.charCodeAt(i);
|
20
|
+
|
21
|
+
if (end === -1 && tokenChars[code] === 1) {
|
22
|
+
if (start === -1) start = i;
|
23
|
+
} else if (
|
24
|
+
i !== 0 &&
|
25
|
+
(code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */
|
26
|
+
) {
|
27
|
+
if (end === -1 && start !== -1) end = i;
|
28
|
+
} else if (code === 0x2c /* ',' */) {
|
29
|
+
if (start === -1) {
|
30
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
31
|
+
}
|
32
|
+
|
33
|
+
if (end === -1) end = i;
|
34
|
+
|
35
|
+
const protocol = header.slice(start, end);
|
36
|
+
|
37
|
+
if (protocols.has(protocol)) {
|
38
|
+
throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
39
|
+
}
|
40
|
+
|
41
|
+
protocols.add(protocol);
|
42
|
+
start = end = -1;
|
43
|
+
} else {
|
44
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
if (start === -1 || end !== -1) {
|
49
|
+
throw new SyntaxError('Unexpected end of input');
|
50
|
+
}
|
51
|
+
|
52
|
+
const protocol = header.slice(start, i);
|
53
|
+
|
54
|
+
if (protocols.has(protocol)) {
|
55
|
+
throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
56
|
+
}
|
57
|
+
|
58
|
+
protocols.add(protocol);
|
59
|
+
return protocols;
|
60
|
+
}
|
61
|
+
|
62
|
+
module.exports = { parse };
|
@@ -1,5 +1,28 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
//
|
4
|
+
// Allowed token characters:
|
5
|
+
//
|
6
|
+
// '!', '#', '$', '%', '&', ''', '*', '+', '-',
|
7
|
+
// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~'
|
8
|
+
//
|
9
|
+
// tokenChars[32] === 0 // ' '
|
10
|
+
// tokenChars[33] === 1 // '!'
|
11
|
+
// tokenChars[34] === 0 // '"'
|
12
|
+
// ...
|
13
|
+
//
|
14
|
+
// prettier-ignore
|
15
|
+
const tokenChars = [
|
16
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
|
17
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
|
18
|
+
0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47
|
19
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63
|
20
|
+
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79
|
21
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95
|
22
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111
|
23
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127
|
24
|
+
];
|
25
|
+
|
3
26
|
/**
|
4
27
|
* Checks if a status code is allowed in a close frame.
|
5
28
|
*
|
@@ -83,22 +106,19 @@ function _isValidUTF8(buf) {
|
|
83
106
|
}
|
84
107
|
|
85
108
|
try {
|
86
|
-
|
87
|
-
|
88
|
-
/* istanbul ignore if */
|
89
|
-
if (typeof isValidUTF8 === 'object') {
|
90
|
-
isValidUTF8 = isValidUTF8.Validation.isValidUTF8; // utf-8-validate@<3.0.0
|
91
|
-
}
|
109
|
+
const isValidUTF8 = require('utf-8-validate');
|
92
110
|
|
93
111
|
module.exports = {
|
94
112
|
isValidStatusCode,
|
95
113
|
isValidUTF8(buf) {
|
96
114
|
return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
97
|
-
}
|
115
|
+
},
|
116
|
+
tokenChars
|
98
117
|
};
|
99
118
|
} catch (e) /* istanbul ignore next */ {
|
100
119
|
module.exports = {
|
101
120
|
isValidStatusCode,
|
102
|
-
isValidUTF8: _isValidUTF8
|
121
|
+
isValidUTF8: _isValidUTF8,
|
122
|
+
tokenChars
|
103
123
|
};
|
104
124
|
}
|