diff --git a/lib/websocket/driver/draft75.js b/lib/websocket/driver/draft75.js index 5be0201..1ec1a34 100644 --- a/lib/websocket/driver/draft75.js +++ b/lib/websocket/driver/draft75.js @@ -5,7 +5,7 @@ var Base = require('./base'), var Draft75 = function(request, url, options) { Base.apply(this, arguments); - this._stage = 0; + this._stage = 0; this.version = 'hixie-75'; this._headers.set('Upgrade', 'WebSocket'); @@ -29,7 +29,7 @@ var instance = { this._reader.put(chunk); this._reader.eachByte(function(octet) { - var message, value; + var message; switch (this._stage) { case -1: @@ -42,19 +42,18 @@ var instance = { break; case 1: - value = (octet & 0x7F); - this._length = value + 128 * this._length; + this._length = (octet & 0x7F) + 128 * this._length; if (this._closing && this._length === 0) { return this.close(); } - else if ((0x80 & octet) !== 0x80) { + else if ((octet & 0x80) !== 0x80) { if (this._length === 0) { this._stage = 0; } else { this._skipped = 0; - this._stage = 2; + this._stage = 2; } } break; @@ -103,14 +102,14 @@ var instance = { }, _parseLeadingByte: function(octet) { - if ((0x80 & octet) === 0x80) { + if ((octet & 0x80) === 0x80) { this._length = 0; - this._stage = 1; + this._stage = 1; } else { delete this._length; delete this._skipped; this._buffer = []; - this._stage = 2; + this._stage = 2; } } };