diff --git a/.travis.yml b/.travis.yml index 968ece7d4..fbda89be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ sudo: false language: node_js node_js: - - "4" - - "6" - "8" - "9" git: diff --git a/lib/server.js b/lib/server.js index df4058ea5..2d9a45c7a 100644 --- a/lib/server.js +++ b/lib/server.js @@ -148,6 +148,7 @@ Server.prototype.verify = function (req, upgrade, fn) { var isOriginInvalid = checkInvalidHeaderChar(req.headers.origin); if (isOriginInvalid) { req.headers.origin = null; + debug('origin header invalid'); return fn(Server.errors.BAD_REQUEST, false); } @@ -155,6 +156,7 @@ Server.prototype.verify = function (req, upgrade, fn) { var sid = req._query.sid; if (sid) { if (!this.clients.hasOwnProperty(sid)) { + debug('unknown sid "%s"', sid); return fn(Server.errors.UNKNOWN_SID, false); } if (!upgrade && this.clients[sid].transport.name !== transport) { @@ -309,6 +311,7 @@ Server.prototype.handshake = function (transportName, req) { transport.supportsBinary = true; } } catch (e) { + debug('error handshaking to transport "%s"', transportName); sendErrorMessage(req, req.res, Server.errors.BAD_REQUEST); return; } @@ -552,23 +555,33 @@ function checkInvalidHeaderChar(val) { val += ''; if (val.length < 1) return false; - if (!validHdrChars[val.charCodeAt(0)]) + if (!validHdrChars[val.charCodeAt(0)]) { + debug('invalid header, index 0, char "%s"', val.charCodeAt(0)); return true; + } if (val.length < 2) return false; - if (!validHdrChars[val.charCodeAt(1)]) + if (!validHdrChars[val.charCodeAt(1)]) { + debug('invalid header, index 1, char "%s"', val.charCodeAt(1)); return true; + } if (val.length < 3) return false; - if (!validHdrChars[val.charCodeAt(2)]) + if (!validHdrChars[val.charCodeAt(2)]) { + debug('invalid header, index 2, char "%s"', val.charCodeAt(2)); return true; + } if (val.length < 4) return false; - if (!validHdrChars[val.charCodeAt(3)]) + if (!validHdrChars[val.charCodeAt(3)]) { + debug('invalid header, index 3, char "%s"', val.charCodeAt(3)); return true; + } for (var i = 4; i < val.length; ++i) { - if (!validHdrChars[val.charCodeAt(i)]) + if (!validHdrChars[val.charCodeAt(i)]) { + debug('invalid header, index "%i", char "%s"', i, val.charCodeAt(i)); return true; + } } return false; } diff --git a/package.json b/package.json index caac4c850..d99b2c31b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "engine.io", - "version": "3.3.2", + "version": "3.4.0", "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", "main": "lib/engine.io", "author": "Guillermo Rauch ", @@ -26,16 +26,16 @@ "license": "MIT", "dependencies": { "accepts": "~1.3.4", - "base64id": "1.0.0", - "debug": "~3.1.0", - "engine.io-parser": "~2.1.0", - "ws": "~6.1.0", - "cookie": "0.3.1" + "base64id": "2.0.0", + "cookie": "0.3.1", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "ws": "^7.1.2" }, "devDependencies": { "babel-eslint": "^8.0.2", "babel-preset-es2015": "^6.24.0", - "engine.io-client": "3.3.1", + "engine.io-client": "3.4.0", "eslint": "^4.5.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.7.0", diff --git a/test/engine.io.js b/test/engine.io.js index c29d3934c..9387094c9 100644 --- a/test/engine.io.js +++ b/test/engine.io.js @@ -19,7 +19,7 @@ describe('engine', function () { expect(eio.protocol).to.be.a('number'); }); - it.skip('should be the same version as client', function () { + it('should be the same version as client', function () { var version = require('../package').version; expect(version).to.be(require('engine.io-client/package').version); });