engine.io
Advanced tools
+9
-0
@@ -0,1 +1,10 @@ | ||
| ## [4.0.1](https://github.com/socketio/engine.io/compare/4.0.0...4.0.1) (2020-10-21) | ||
| ### Bug Fixes | ||
| * do not overwrite CORS headers upon error ([fe093ba](https://github.com/socketio/engine.io/commit/fe093bae1adce99e01dfdd3ce7542957785098b5)) | ||
| # [4.0.0](https://github.com/socketio/engine.io/compare/v4.0.0-alpha.1...4.0.0) (2020-09-10) | ||
@@ -2,0 +11,0 @@ |
+0
-6
@@ -478,8 +478,2 @@ const qs = require("querystring"); | ||
| } | ||
| if (req.headers.origin) { | ||
| headers["Access-Control-Allow-Credentials"] = "true"; | ||
| headers["Access-Control-Allow-Origin"] = req.headers.origin; | ||
| } else { | ||
| headers["Access-Control-Allow-Origin"] = "*"; | ||
| } | ||
| if (res !== undefined) { | ||
@@ -486,0 +480,0 @@ res.writeHead(400, headers); |
@@ -112,8 +112,6 @@ const Transport = require("../transport"); | ||
| const isBinary = "application/octet-stream" === req.headers["content-type"]; | ||
| this.dataReq = req; | ||
| this.dataRes = res; | ||
| let chunks = isBinary ? Buffer.concat([]) : ""; | ||
| let chunks = ""; | ||
| const self = this; | ||
@@ -135,12 +133,7 @@ | ||
| let contentLength; | ||
| if (isBinary) { | ||
| chunks = Buffer.concat([chunks, data]); | ||
| contentLength = chunks.length; | ||
| } else { | ||
| chunks += data; | ||
| contentLength = Buffer.byteLength(chunks); | ||
| } | ||
| chunks += data; | ||
| contentLength = Buffer.byteLength(chunks); | ||
| if (contentLength > self.maxHttpBufferSize) { | ||
| chunks = isBinary ? Buffer.concat([]) : ""; | ||
| chunks = ""; | ||
| req.connection.destroy(); | ||
@@ -166,3 +159,3 @@ } | ||
| req.on("close", onClose); | ||
| if (!isBinary) req.setEncoding("utf8"); | ||
| req.setEncoding("utf8"); | ||
| req.on("data", onData); | ||
@@ -169,0 +162,0 @@ req.on("end", onEnd); |
+4
-4
| { | ||
| "name": "engine.io", | ||
| "version": "4.0.0", | ||
| "version": "4.0.1", | ||
| "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", | ||
@@ -38,2 +38,3 @@ "main": "lib/engine.io", | ||
| "babel-eslint": "^8.0.2", | ||
| "eiows": "^3.3.0", | ||
| "engine.io-client": "4.0.0", | ||
@@ -46,8 +47,7 @@ "eslint": "^4.19.1", | ||
| "s": "0.1.1", | ||
| "superagent": "^3.8.1", | ||
| "uws": "github:mmdevries/uws#2.4.1" | ||
| "superagent": "^3.8.1" | ||
| }, | ||
| "scripts": { | ||
| "lint": "eslint lib/ test/ *.js", | ||
| "test": "npm run lint && npm run format:check && mocha && EIO_WS_ENGINE=uws mocha", | ||
| "test": "npm run lint && npm run format:check && mocha && EIO_WS_ENGINE=eiows mocha", | ||
| "format:check": "prettier --check 'lib/**/*.js' 'test/**/*.js'", | ||
@@ -54,0 +54,0 @@ "format:fix": "prettier --write 'lib/**/*.js' 'test/**/*.js'" |
+33
-32
@@ -18,6 +18,6 @@ | ||
| ```js | ||
| var engine = require('engine.io'); | ||
| var server = engine.listen(80); | ||
| const engine = require('engine.io'); | ||
| const server = engine.listen(80); | ||
| server.on('connection', function(socket){ | ||
| server.on('connection', socket => { | ||
| socket.send('utf 8 string'); | ||
@@ -31,9 +31,9 @@ socket.send(Buffer.from([0, 1, 2, 3, 4, 5])); // binary data | ||
| ```js | ||
| var engine = require('engine.io'); | ||
| var http = require('http').createServer().listen(3000); | ||
| var server = engine.attach(http); | ||
| const engine = require('engine.io'); | ||
| const http = require('http').createServer().listen(3000); | ||
| const server = engine.attach(http); | ||
| server.on('connection', function (socket) { | ||
| socket.on('message', function(data){ }); | ||
| socket.on('close', function(){ }); | ||
| server.on('connection', socket => { | ||
| socket.on('message', data => { }); | ||
| socket.on('close', () => { }); | ||
| }); | ||
@@ -45,6 +45,6 @@ ``` | ||
| ```js | ||
| var engine = require('engine.io'); | ||
| var server = new engine.Server(); | ||
| const engine = require('engine.io'); | ||
| const server = new engine.Server(); | ||
| server.on('connection', function(socket){ | ||
| server.on('connection', socket => { | ||
| socket.send('hi'); | ||
@@ -54,6 +54,7 @@ }); | ||
| // … | ||
| httpServer.on('upgrade', function(req, socket, head){ | ||
| httpServer.on('upgrade', (req, socket, head) => { | ||
| server.handleUpgrade(req, socket, head); | ||
| }); | ||
| httpServer.on('request', function(req, res){ | ||
| httpServer.on('request', (req, res) => { | ||
| server.handleRequest(req, res); | ||
@@ -68,6 +69,6 @@ }); | ||
| <script> | ||
| var socket = new eio.Socket('ws://localhost/'); | ||
| socket.on('open', function(){ | ||
| socket.on('message', function(data){}); | ||
| socket.on('close', function(){}); | ||
| const socket = new eio.Socket('ws://localhost/'); | ||
| socket.on('open', () => { | ||
| socket.on('message', data => {}); | ||
| socket.on('close', () => {}); | ||
| }); | ||
@@ -78,3 +79,3 @@ </script> | ||
| For more information on the client refer to the | ||
| [engine-client](http://github.com/learnboost/engine.io-client) repository. | ||
| [engine-client](http://github.com/socketio/engine.io-client) repository. | ||
@@ -140,17 +141,17 @@ ## What features does it have? | ||
| ```js | ||
| var httpServer; // previously created with `http.createServer();` from node.js api. | ||
| const httpServer; // previously created with `http.createServer();` from node.js api. | ||
| // create a server first, and then attach | ||
| var eioServer = require('engine.io').Server(); | ||
| const eioServer = require('engine.io').Server(); | ||
| eioServer.attach(httpServer); | ||
| // or call the module as a function to get `Server` | ||
| var eioServer = require('engine.io')(); | ||
| const eioServer = require('engine.io')(); | ||
| eioServer.attach(httpServer); | ||
| // immediately attach | ||
| var eioServer = require('engine.io')(httpServer); | ||
| const eioServer = require('engine.io')(httpServer); | ||
| // with custom options | ||
| var eioServer = require('engine.io')(httpServer, { | ||
| const eioServer = require('engine.io')(httpServer, { | ||
| maxHttpBufferSize: 1e3 | ||
@@ -173,4 +174,4 @@ }); | ||
| ```js | ||
| var engine = require('engine.io'); | ||
| var server = engine.listen(3000, { | ||
| const engine = require('engine.io'); | ||
| const server = engine.listen(3000, { | ||
| pingTimeout: 2000, | ||
@@ -195,5 +196,5 @@ pingInterval: 10000 | ||
| ```js | ||
| var engine = require('engine.io'); | ||
| var httpServer = require('http').createServer().listen(3000); | ||
| var server = engine.attach(httpServer, { | ||
| const engine = require('engine.io'); | ||
| const httpServer = require('http').createServer().listen(3000); | ||
| const server = engine.attach(httpServer, { | ||
| wsEngine: 'uws' // requires having uws as dependency | ||
@@ -543,5 +544,5 @@ }); | ||
| Absolutely. The [engine.io-protocol](https://github.com/LearnBoost/engine.io-protocol) | ||
| repository contains the most up to date description of the specification | ||
| at all times, and the parser implementation in JavaScript. | ||
| Absolutely. The [engine.io-protocol](https://github.com/socketio/engine.io-protocol) | ||
| repository contains the most up-to-date description of the specification | ||
| at all times. | ||
@@ -548,0 +549,0 @@ ## License |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
563
0.18%73304
-0.47%1651
-0.72%