Skip to content
Snippets Groups Projects
Commit 3adab634 authored by jurgenhaas's avatar jurgenhaas
Browse files

#4 Update socket.io

parent 9a36ee82
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
"ejs": "0.8.3",
"config": "0.4.32",
"async": "0.1.22",
"socket.io": "0.9.14",
"socket.io": "0.9.17",
"semver": "1.1.0",
"moment": "2.1.0",
"nodemailer": "0.3.35",
......
Index: node_modules/socket.io/lib/store.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- node_modules/socket.io/lib/store.js (revision )
+++ node_modules/socket.io/lib/store.js (revision )
@@ -15,7 +15,7 @@
* Module dependencies.
*/
-var EventEmitter = process.EventEmitter;
+var EventEmitter = require('events').EventEmitter;
/**
* Store interface
Index: node_modules/socket.io/lib/manager.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- node_modules/socket.io/lib/manager.js (revision )
+++ node_modules/socket.io/lib/manager.js (revision )
@@ -21,7 +21,7 @@
, MemoryStore = require('./stores/memory')
, SocketNamespace = require('./namespace')
, Static = require('./static')
- , EventEmitter = process.EventEmitter;
+ , EventEmitter = require('events').EventEmitter;
/**
* Export the constructor.
@@ -146,7 +146,7 @@
});
this.sequenceNumber = Date.now() | 0;
-
+
this.log.info('socket.io started');
};
Index: node_modules/socket.io/lib/transports/websocket/default.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- node_modules/socket.io/lib/transports/websocket/default.js (revision )
+++ node_modules/socket.io/lib/transports/websocket/default.js (revision )
@@ -9,7 +9,7 @@
*/
var Transport = require('../../transport')
- , EventEmitter = process.EventEmitter
+ , EventEmitter = require('events').EventEmitter
, crypto = require('crypto')
, parser = require('../../parser');
Index: node_modules/socket.io/lib/transports/websocket/hybi-16.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- node_modules/socket.io/lib/transports/websocket/hybi-16.js (revision )
+++ node_modules/socket.io/lib/transports/websocket/hybi-16.js (revision )
@@ -3,13 +3,13 @@
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
-
+
/**
* Module requirements.
*/
var Transport = require('../../transport')
- , EventEmitter = process.EventEmitter
+ , EventEmitter = require('events').EventEmitter
, crypto = require('crypto')
, url = require('url')
, parser = require('../../parser')
@@ -95,7 +95,7 @@
WebSocket.prototype.onSocketConnect = function () {
var self = this;
- if (typeof this.req.headers.upgrade === 'undefined' ||
+ if (typeof this.req.headers.upgrade === 'undefined' ||
this.req.headers.upgrade.toLowerCase() !== 'websocket') {
this.log.warn(this.name + ' connection invalid');
this.end();
@@ -107,23 +107,23 @@
origin.match(/^https/) : this.socket.encrypted) ?
'wss' : 'ws')
+ '://' + this.req.headers.host + this.req.url;
-
+
if (!this.verifyOrigin(origin)) {
this.log.warn(this.name + ' connection invalid: origin mismatch');
this.end();
- return;
+ return;
}
-
+
if (!this.req.headers['sec-websocket-key']) {
this.log.warn(this.name + ' connection invalid: received no key');
this.end();
return;
}
-
+
// calc key
- var key = this.req.headers['sec-websocket-key'];
- var shasum = crypto.createHash('sha1');
- shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ var key = this.req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
key = shasum.digest('base64');
var headers = [
@@ -177,7 +177,7 @@
}
}
else {
- this.log.warn('origin missing from websocket call, yet required by config');
+ this.log.warn('origin missing from websocket call, yet required by config');
}
return false;
};
@@ -269,7 +269,7 @@
*
* @api public
*/
-
+
function Parser (opts) {
this.state = {
activeFragmentedOperation: null,
@@ -285,7 +285,7 @@
this._maxBuffer = (opts && opts.maxBuffer) || 10E7;
this._dataLength = 0;
- var self = this;
+ var self = this;
this.opcodeHandlers = {
// text
'1': function(data) {
@@ -308,10 +308,10 @@
});
}
else {
- self.expect('Data', length, function(data) {
+ self.expect('Data', length, function(data) {
finish(null, data);
});
- }
+ }
}
// decode length
@@ -333,7 +333,7 @@
var lengthBytes = data.slice(4); // note: cap to 32 bit length
expectData(util.unpack(data));
});
- }
+ }
},
// binary
'2': function(data) {
@@ -357,10 +357,10 @@
});
}
else {
- self.expect('Data', length, function(data) {
+ self.expect('Data', length, function(data) {
finish(null, data);
});
- }
+ }
}
// decode length
@@ -382,7 +382,7 @@
var lengthBytes = data.slice(4); // note: cap to 32 bit length
expectData(util.unpack(data));
});
- }
+ }
},
// close
'8': function(data) {
@@ -395,7 +395,7 @@
self.error('fragmented ping is not supported');
return;
}
-
+
var finish = function(mask, data) {
self.emit('ping', self.unmask(mask, data));
self.endPacket();
@@ -411,16 +411,16 @@
});
}
else {
- self.expect('Data', length, function(data) {
+ self.expect('Data', length, function(data) {
finish(null, data);
});
- }
+ }
}
// decode length
var firstLength = data[1] & 0x7f;
if (firstLength == 0) {
- finish(null, null);
+ finish(null, null);
}
else if (firstLength < 126) {
expectData(firstLength);
@@ -434,11 +434,11 @@
self.expect('Length', 8, function(data) {
expectData(util.unpack(data));
});
- }
+ }
}
}
- this.expect('Opcode', 2, this.processPacket);
+ this.expect('Opcode', 2, this.processPacket);
};
/**
@@ -496,7 +496,7 @@
this.overflow = new Buffer(this.overflow.length + data.length);
prevOverflow.copy(this.overflow, 0);
data.copy(this.overflow, prevOverflow.length);
- }
+ }
}
/**
@@ -530,11 +530,11 @@
if ((data[0] & 0x70) != 0) {
this.error('reserved fields must be empty');
return;
- }
- this.state.lastFragment = (data[0] & 0x80) == 0x80;
+ }
+ this.state.lastFragment = (data[0] & 0x80) == 0x80;
this.state.masked = (data[1] & 0x80) == 0x80;
var opcode = data[0] & 0xf;
- if (opcode == 0) {
+ if (opcode == 0) {
// continuation frame
this.state.opcode = this.state.activeFragmentedOperation;
if (!(this.state.opcode == 1 || this.state.opcode == 2)) {
@@ -542,7 +542,7 @@
return;
}
}
- else {
+ else {
this.state.opcode = opcode;
if (this.state.lastFragment === false) {
this.state.activeFragmentedOperation = opcode;
@@ -570,7 +570,7 @@
this.state.lastFragment = false;
this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0;
this.state.masked = false;
- this.expect('Opcode', 2, this.processPacket);
+ this.expect('Opcode', 2, this.processPacket);
}
/**
@@ -603,7 +603,7 @@
if (mask != null) {
for (var i = 0, ll = buf.length; i < ll; i++) {
buf[i] ^= mask[i % 4];
- }
+ }
}
if (binary) return buf;
return buf != null ? buf.toString('utf8') : '';
Index: node_modules/socket.io/lib/transports/websocket/hybi-07-12.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- node_modules/socket.io/lib/transports/websocket/hybi-07-12.js (revision )
+++ node_modules/socket.io/lib/transports/websocket/hybi-07-12.js (revision )
@@ -4,13 +4,13 @@
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
-
+
/**
* Module requirements.
*/
var Transport = require('../../transport')
- , EventEmitter = process.EventEmitter
+ , EventEmitter = require('events').EventEmitter
, crypto = require('crypto')
, url = require('url')
, parser = require('../../parser')
@@ -96,7 +96,7 @@
WebSocket.prototype.onSocketConnect = function () {
var self = this;
- if (typeof this.req.headers.upgrade === 'undefined' ||
+ if (typeof this.req.headers.upgrade === 'undefined' ||
this.req.headers.upgrade.toLowerCase() !== 'websocket') {
this.log.warn(this.name + ' connection invalid');
this.end();
@@ -108,23 +108,23 @@
origin.match(/^https/) : this.socket.encrypted) ?
'wss' : 'ws')
+ '://' + this.req.headers.host + this.req.url;
-
+
if (!this.verifyOrigin(origin)) {
this.log.warn(this.name + ' connection invalid: origin mismatch');
this.end();
- return;
+ return;
}
-
+
if (!this.req.headers['sec-websocket-key']) {
this.log.warn(this.name + ' connection invalid: received no key');
this.end();
return;
}
-
+
// calc key
- var key = this.req.headers['sec-websocket-key'];
- var shasum = crypto.createHash('sha1');
- shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ var key = this.req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
key = shasum.digest('base64');
var headers = [
@@ -178,7 +178,7 @@
}
}
else {
- this.log.warn('origin missing from websocket call, yet required by config');
+ this.log.warn('origin missing from websocket call, yet required by config');
}
return false;
};
@@ -270,7 +270,7 @@
*
* @api public
*/
-
+
function Parser (opts) {
this.state = {
activeFragmentedOperation: null,
@@ -286,7 +286,7 @@
this._maxBuffer = (opts && opts.maxBuffer) || 10E7;
this._dataLength = 0;
- var self = this;
+ var self = this;
this.opcodeHandlers = {
// text
'1': function(data) {
@@ -309,10 +309,10 @@
});
}
else {
- self.expect('Data', length, function(data) {
+ self.expect('Data', length, function(data) {
finish(null, data);
});
- }
+ }
}
// decode length
@@ -334,7 +334,7 @@
var lengthBytes = data.slice(4); // note: cap to 32 bit length
expectData(util.unpack(data));
});
- }
+ }
},
// binary
'2': function(data) {
@@ -358,10 +358,10 @@
});
}
else {
- self.expect('Data', length, function(data) {
+ self.expect('Data', length, function(data) {
finish(null, data);
});
- }
+ }
}
// decode length
@@ -383,7 +383,7 @@
var lengthBytes = data.slice(4); // note: cap to 32 bit length
expectData(util.unpack(data));
});
- }
+ }
},
// close
'8': function(data) {
@@ -396,7 +396,7 @@
self.error('fragmented ping is not supported');
return;
}
-
+
var finish = function(mask, data) {
self.emit('ping', self.unmask(mask, data));
self.endPacket();
@@ -412,16 +412,16 @@
});
}
else {
- self.expect('Data', length, function(data) {
+ self.expect('Data', length, function(data) {
finish(null, data);
});
- }
+ }
}
// decode length
var firstLength = data[1] & 0x7f;
if (firstLength == 0) {
- finish(null, null);
+ finish(null, null);
}
else if (firstLength < 126) {
expectData(firstLength);
@@ -435,11 +435,11 @@
self.expect('Length', 8, function(data) {
expectData(util.unpack(data));
});
- }
+ }
}
}
- this.expect('Opcode', 2, this.processPacket);
+ this.expect('Opcode', 2, this.processPacket);
};
/**
@@ -497,7 +497,7 @@
this.overflow = new Buffer(this.overflow.length + data.length);
prevOverflow.copy(this.overflow, 0);
data.copy(this.overflow, prevOverflow.length);
- }
+ }
}
/**
@@ -531,10 +531,10 @@
if ((data[0] & 0x70) != 0) {
this.error('reserved fields must be empty');
}
- this.state.lastFragment = (data[0] & 0x80) == 0x80;
+ this.state.lastFragment = (data[0] & 0x80) == 0x80;
this.state.masked = (data[1] & 0x80) == 0x80;
var opcode = data[0] & 0xf;
- if (opcode == 0) {
+ if (opcode == 0) {
// continuation frame
this.state.opcode = this.state.activeFragmentedOperation;
if (!(this.state.opcode == 1 || this.state.opcode == 2)) {
@@ -542,7 +542,7 @@
return;
}
}
- else {
+ else {
this.state.opcode = opcode;
if (this.state.lastFragment === false) {
this.state.activeFragmentedOperation = opcode;
@@ -570,7 +570,7 @@
this.state.lastFragment = false;
this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0;
this.state.masked = false;
- this.expect('Opcode', 2, this.processPacket);
+ this.expect('Opcode', 2, this.processPacket);
}
/**
@@ -603,7 +603,7 @@
if (mask != null) {
for (var i = 0, ll = buf.length; i < ll; i++) {
buf[i] ^= mask[i % 4];
- }
+ }
}
if (binary) return buf;
return buf != null ? buf.toString('utf8') : '';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment