Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine.io

Package Overview
Dependencies
Maintainers
2
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

26

lib/server.js

@@ -48,2 +48,3 @@

this.cookie = false !== opts.cookie ? (opts.cookie || 'io') : false;
this.origins = opts.origins || '*';
this.cookiePath = false !== opts.cookiePath ? (opts.cookiePath || '/') : false;

@@ -225,3 +226,3 @@ this.cookieHttpOnly = false !== opts.cookieHttpOnly;

if (!success) {
sendErrorMessage(req, res, err);
self.sendErrorMessage(req, res, err);
return;

@@ -247,3 +248,3 @@ }

function sendErrorMessage (req, res, code) {
Server.prototype.sendErrorMessage = function (req, res, code) {
var headers = { 'Content-Type': 'application/json' };

@@ -260,8 +261,9 @@

}
headers['Access-Control-Allow-Origin'] = this.origins;
headers['Vary'] = 'Origin';
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) {

@@ -274,3 +276,3 @@ res.writeHead(400, headers);

}
}
};

@@ -301,5 +303,8 @@ /**

debug('handshaking client "%s"', id);
var opts = {
origins: this.origins
};
try {
var transport = new transports[transportName](req);
var transport = new transports[transportName](req, opts);
if ('polling' === transportName) {

@@ -318,3 +323,3 @@ transport.maxHttpBufferSize = this.maxHttpBufferSize;

} catch (e) {
sendErrorMessage(req, req.res, Server.errors.BAD_REQUEST);
this.sendErrorMessage(req, req.res, Server.errors.BAD_REQUEST);
return;

@@ -414,3 +419,6 @@ }

var transport = new transports[req._query.transport](req);
var opts = {
origins: this.origins
};
var transport = new transports[req._query.transport](req, opts);
if (req._query && req._query.b64) {

@@ -417,0 +425,0 @@ transport.supportsBinary = false;

@@ -29,8 +29,10 @@

* @param {http.IncomingMessage} request
* @param {Object} opts allows the origins option to be passed along
* @api public
*/
function Transport (req) {
function Transport (req, opts) {
this.readyState = 'open';
this.discarded = false;
this.origins = opts.origins;
}

@@ -37,0 +39,0 @@

@@ -30,8 +30,8 @@

function polling (req) {
function polling (req, opts) {
if ('string' === typeof req._query.j) {
return new JSONP(req);
return new JSONP(req, opts);
} else {
return new XHR(req);
return new XHR(req, opts);
}
}

@@ -24,4 +24,4 @@

function JSONP (req) {
Polling.call(this, req);
function JSONP (req, opts) {
Polling.call(this, req, opts);

@@ -28,0 +28,0 @@ this.head = '___eio[' + (req._query.j || '').replace(/[^0-9]/g, '') + '](';

@@ -21,4 +21,4 @@

function XHR (req) {
Polling.call(this, req);
function XHR (req, opts) {
Polling.call(this, req, opts);
}

@@ -62,7 +62,6 @@

headers['Access-Control-Allow-Origin'] = this.origins;
headers['Vary'] = 'Origin';
if (req.headers.origin) {
headers['Access-Control-Allow-Credentials'] = 'true';
headers['Access-Control-Allow-Origin'] = req.headers.origin;
} else {
headers['Access-Control-Allow-Origin'] = '*';
}

@@ -69,0 +68,0 @@

@@ -30,4 +30,4 @@

function Polling (req) {
Transport.call(this, req);
function Polling (req, opts) {
Transport.call(this, req, opts);

@@ -34,0 +34,0 @@ this.closeTimeout = 30 * 1000;

@@ -24,4 +24,4 @@

function WebSocket (req) {
Transport.call(this, req);
function WebSocket (req, opts) {
Transport.call(this, req, opts);
var self = this;

@@ -28,0 +28,0 @@ this.socket = req.websocket;

{
"name": "engine.io",
"version": "3.2.1",
"version": "3.3.0",
"description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server",

@@ -32,3 +32,3 @@ "main": "lib/engine.io",

"engine.io-parser": "~2.1.0",
"ws": "~3.3.1",
"ws": "~6.1.0",
"cookie": "0.3.1"

@@ -39,3 +39,3 @@ },

"babel-preset-es2015": "^6.24.0",
"engine.io-client": "3.2.1",
"engine.io-client": "3.3.0",
"eslint": "^4.5.0",

@@ -42,0 +42,0 @@ "eslint-config-standard": "^10.2.1",

@@ -231,2 +231,3 @@

value is `10E7`.
- `origins` (`String`): the allowed origins (`*`)
- `allowRequest` (`Function`): A function that receives a given handshake

@@ -233,0 +234,0 @@ or upgrade request as its first parameter, and can decide whether to

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc