+6
-17
@@ -63,2 +63,3 @@ 'use strict'; | ||
| this._messageLength = 0; | ||
| this._numFragments = 0; | ||
| this._fragments = []; | ||
@@ -351,2 +352,7 @@ | ||
| if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) { | ||
| this._loop = false; | ||
| return error(RangeError, 'Too many message fragments', false, 1008); | ||
| } | ||
| if (this._compressed) { | ||
@@ -359,10 +365,2 @@ this._state = INFLATING; | ||
| if (data.length) { | ||
| if ( | ||
| this._maxFragments > 0 && | ||
| this._fragments.length >= this._maxFragments | ||
| ) { | ||
| this._loop = false; | ||
| return error(RangeError, 'Too many message fragments', false, 1008); | ||
| } | ||
| // | ||
@@ -398,11 +396,2 @@ // This message is not compressed so its lenght is the sum of the payload | ||
| if ( | ||
| this._maxFragments > 0 && | ||
| this._fragments.length >= this._maxFragments | ||
| ) { | ||
| return cb( | ||
| error(RangeError, 'Too many message fragments', false, 1008) | ||
| ); | ||
| } | ||
| this._fragments.push(buf); | ||
@@ -409,0 +398,0 @@ } |
@@ -32,5 +32,5 @@ 'use strict'; | ||
| * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate | ||
| * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of | ||
| * @param {Number} [options.maxBufferedChunks=262144] The maximum number of | ||
| * buffered data chunks | ||
| * @param {Number} [options.maxFragments=131072] The maximum number of message | ||
| * @param {Number} [options.maxFragments=16384] The maximum number of message | ||
| * fragments | ||
@@ -44,4 +44,4 @@ * @param {Number} options.maxPayload The maximum allowed message size | ||
| options = Object.assign({ | ||
| maxBufferedChunks: 1024 * 1024, | ||
| maxFragments: 128 * 1024, | ||
| maxBufferedChunks: 256 * 1024, | ||
| maxFragments: 16 * 1024, | ||
| maxPayload: 100 * 1024 * 1024, | ||
@@ -48,0 +48,0 @@ perMessageDeflate: false, |
+4
-4
@@ -420,5 +420,5 @@ 'use strict'; | ||
| * @param {String} options.origin Value of the `Origin` or `Sec-WebSocket-Origin` header | ||
| * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of | ||
| * @param {Number} [options.maxBufferedChunks=262144] The maximum number of | ||
| * buffered data chunks | ||
| * @param {Number} [options.maxFragments=131072] The maximum number of message | ||
| * @param {Number} [options.maxFragments=16384] The maximum number of message | ||
| * fragments | ||
@@ -430,4 +430,4 @@ * @private | ||
| protocolVersion: protocolVersions[1], | ||
| maxBufferedChunks: 1024 * 1024, | ||
| maxFragments: 128 * 1024, | ||
| maxBufferedChunks: 256 * 1024, | ||
| maxFragments: 16 * 1024, | ||
| perMessageDeflate: true | ||
@@ -434,0 +434,0 @@ }, options, { |
+1
-1
| { | ||
| "name": "ws", | ||
| "version": "5.2.5", | ||
| "version": "5.2.6", | ||
| "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
101286
-0.25%2779
-0.36%