Skip to content

Commit f5a90ac

Browse files
committed
Remove data-type check in websocket.
1 parent 26f900b commit f5a90ac

2 files changed

Lines changed: 1 addition & 24 deletions

File tree

index.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13170,15 +13170,9 @@ WebSocketClient.prototype.$ondata = function(data) {
1317013170

1317113171
var tmp;
1317213172

13173-
// @TODO: add a check for mixin types (text/binary)
1317413173
switch (current.type === 0x00 ? current.type2 : current.type) {
1317513174
case 0x01:
1317613175

13177-
if (this.type === 1) {
13178-
this.close('Invalid data type.');
13179-
return;
13180-
}
13181-
1318213176
// text
1318313177
if (this.inflate) {
1318413178
current.final && this.parseInflate();
@@ -13196,12 +13190,6 @@ WebSocketClient.prototype.$ondata = function(data) {
1319613190
case 0x02:
1319713191

1319813192
// binary
13199-
13200-
if (this.type !== 1) {
13201-
this.close('Invalid data type.');
13202-
return;
13203-
}
13204-
1320513193
if (this.inflate) {
1320613194
current.final && this.parseInflate();
1320713195
} else {

websocketclient.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,6 @@ WebSocketClient.prototype.$ondata = function(data) {
258258
switch (current.type === 0x00 ? current.type2 : current.type) {
259259
case 0x01:
260260

261-
if (this.type === 1) {
262-
this.close('Invalid data type.');
263-
return;
264-
}
265-
266261
// text
267262
if (this.inflate) {
268263
current.final && this.parseInflate();
@@ -278,14 +273,7 @@ WebSocketClient.prototype.$ondata = function(data) {
278273
break;
279274

280275
case 0x02:
281-
282276
// binary
283-
284-
if (this.type !== 1) {
285-
this.close('Invalid data type.');
286-
return;
287-
}
288-
289277
if (this.inflate) {
290278
current.final && this.parseInflate();
291279
} else {
@@ -440,6 +428,7 @@ WebSocketClient.prototype.$readbody = function() {
440428

441429
WebSocketClient.prototype.$decode = function() {
442430
var data = this.current.body;
431+
443432
switch (this.options.type) {
444433

445434
case 'binary': // BINARY

0 commit comments

Comments
 (0)