From f764bf6bce122a75b32f89365472c3c0a08f7a7c Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sat, 5 Dec 2020 01:11:41 +0100 Subject: [PATCH 1/4] ci: migrate to GitHub Actions Due to the recent changes to the Travis CI platform (see [1]), we will now use GitHub Actions to run the tests. Reference: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs [1]: https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing Backported from master: https://github.com/socketio/engine.io-client/commit/20f7fe036323b4903316fce1cec8f75f3c09dc35 --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 19 ------------------ README.md | 2 +- 3 files changed, 44 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..6d8ee0d44 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: + push: + pull_request: + +jobs: + test-node: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [8.x, 10.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm test + env: + CI: true + + test-browser: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '10.x' + - run: npm ci + - run: npm test + env: + CI: true + BROWSERS: 1 + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} + SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} + SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} + timeout-minutes: 10 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a707382a9..000000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: node_js -sudo: false -node_js: - - '8' - - '10' -git: - depth: 1 -matrix: - include: - - node_js: '10' - env: BROWSERS=1 -cache: - directories: - - node_modules -env: - global: - - secure: EeWHa83dNLzbmwn7tai2D7nnqRMhpbZrWh8054je+6M2Iui6heV412ginyx+MfTBkDe9PF9yPhoknpJ1ZiitbFHVhdofzJJErEHWS33gLVXTL2PU1IzAU9h9T/wVSrVsiNfTARW4Bh9JexVl8x8erTzSh/P6fH2KWx4CaPtmYG4= - - secure: 0yzzTFfFW032oyHzLJPkjgtehnJiqbpmI5kPosjC3Nk0AT6wLSdXuo1Cv5mccggPoqtHQ4oo7e4roLgRaZD34ihc2n98oT5LUPoU6ifA2Z+1zmdmFS9oYTvmkMxaxHlyYuWn47INukGLVJkH5mukb4QDji+v2LjbZVGdVHL5iNM= - - secure: l2aD07VwTMZh+8dcE7u7X0lpdYuwl/wk5no1hxaOKvnHiaVSW39kEJFReO0EZXF/ld7teBNwdWVtRK0P28hKjXEr4Z1OjvGyz6WYZ6cSwxAPmDoTaKC4z1NsAlatqjOKyjSqadncYzWwKS+Trxgj8eO1mZt5h+EvgU2gz6l2N+I= diff --git a/README.md b/README.md index ab559f8ca..436f31784 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Engine.IO client -[![Build Status](https://travis-ci.org/socketio/engine.io-client.svg?branch=master)](http://travis-ci.org/socketio/engine.io-client) +[![Build Status](https://github.com/socketio/engine.io-client/workflows/CI/badge.svg)](https://github.com/socketio/engine.io-client/actions) [![NPM version](https://badge.fury.io/js/engine.io-client.svg)](http://badge.fury.io/js/engine.io-client) This is the client for [Engine.IO](http://github.com/socketio/engine.io), From 0b254cef778c7b067b1f0d671a67d62145813d86 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Wed, 30 Dec 2020 08:40:56 +0100 Subject: [PATCH 2/4] chore: bump ws version --- package-lock.json | 58 ++++++++++++----------------------------------- package.json | 2 +- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/package-lock.json b/package-lock.json index 801d17d36..ddfcdf95d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -489,11 +489,6 @@ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2046,8 +2041,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -2068,14 +2062,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2090,20 +2082,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -2220,8 +2209,7 @@ "inherits": { "version": "2.0.4", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -2233,7 +2221,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2248,7 +2235,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2256,14 +2242,12 @@ "minimist": { "version": "1.2.5", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.9.0", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -2282,7 +2266,6 @@ "version": "0.5.3", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "^1.2.5" } @@ -2344,8 +2327,7 @@ "npm-normalize-package-bin": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "npm-packlist": { "version": "1.4.8", @@ -2373,8 +2355,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -2386,7 +2367,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -2464,8 +2444,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -2501,7 +2480,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2521,7 +2499,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2565,14 +2542,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -10995,12 +10970,9 @@ } }, "ws": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", - "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", - "requires": { - "async-limiter": "~1.0.0" - } + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz", + "integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA==" }, "xml-escape": { "version": "1.0.0", diff --git a/package.json b/package.json index bf2745514..ddfe41237 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", - "ws": "~6.1.0", + "ws": "~7.4.2", "xmlhttprequest-ssl": "~1.5.4", "yeast": "0.1.2" }, From 8750356dba5409ba0e1d3a27da6d214118702b3e Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Wed, 30 Dec 2020 08:43:56 +0100 Subject: [PATCH 3/4] fix: check the type of the initial packet Before this fix, the client could mark the polling transport as open even though the handshake packet was not received properly (for example, after a parsing error). This could lead to writes (POST requests) without "sid" query param, which failed with: ``` {"code":2,"message":"Bad handshake method"} ``` Related: - https://github.com/socketio/engine.io-client/issues/636 - https://github.com/socketio/socket.io-client/issues/1390 Cherry-picked from master: https://github.com/socketio/engine.io-client/commit/1c8cba8818e930205918a70f05c1164865842a48 --- lib/transports/polling.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transports/polling.js b/lib/transports/polling.js index 970313ebd..786398bed 100644 --- a/lib/transports/polling.js +++ b/lib/transports/polling.js @@ -130,7 +130,7 @@ Polling.prototype.onData = function (data) { debug('polling got data %s', data); var callback = function (packet, index, total) { // if its the first message we consider the transport open - if ('opening' === self.readyState) { + if ('opening' === self.readyState && packet.type === 'open') { self.onOpen(); } From b1630baa756f1af38573113a8862e6ee270860cd Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Wed, 30 Dec 2020 09:29:16 +0100 Subject: [PATCH 4/4] chore(release): 3.5.0 Diff: https://github.com/socketio/engine.io-client/compare/3.4.4...3.5.0 --- CHANGELOG.md | 9 +++++++++ engine.io.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5ae08ca9..0e274e21a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# [3.5.0](https://github.com/socketio/engine.io-client/compare/3.4.4...3.5.0) (2020-12-30) + + +### Bug Fixes + +* check the type of the initial packet ([8750356](https://github.com/socketio/engine.io-client/commit/8750356dba5409ba0e1d3a27da6d214118702b3e)) + + + ## [3.4.4](https://github.com/socketio/engine.io-client/compare/3.4.3...3.4.4) (2020-09-30) diff --git a/engine.io.js b/engine.io.js index 78bb9f43d..da4ba26fa 100644 --- a/engine.io.js +++ b/engine.io.js @@ -1521,7 +1521,7 @@ return /******/ (function(modules) { // webpackBootstrap debug('polling got data %s', data); var callback = function (packet, index, total) { // if its the first message we consider the transport open - if ('opening' === self.readyState) { + if ('opening' === self.readyState && packet.type === 'open') { self.onOpen(); } diff --git a/package-lock.json b/package-lock.json index ddfcdf95d..48e56c491 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "engine.io-client", - "version": "3.4.4", + "version": "3.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ddfe41237..de22ac875 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "engine.io-client", "description": "Client for the realtime Engine", "license": "MIT", - "version": "3.4.4", + "version": "3.5.0", "main": "lib/index.js", "homepage": "https://github.com/socketio/engine.io-client", "contributors": [