Skip to content

Commit

Permalink
circumvents socketio#602 .. although only a horribly malformed websoc…
Browse files Browse the repository at this point in the history
…ket connection could potentially cause this
  • Loading branch information
einaros committed Oct 28, 2011
1 parent 8339c96 commit 92a3cce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/transports/websocket/hybi-07-12.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ WebSocket.prototype.protocolVersion = '07-12';
WebSocket.prototype.onSocketConnect = function () {
var self = this;

if (this.req.headers.upgrade.toLowerCase() !== 'websocket') {
if (typeof this.req.headers.upgrade === 'undefined' ||
this.req.headers.upgrade.toLowerCase() !== 'websocket') {
this.log.warn(this.name + ' connection invalid');
this.end();
return;
Expand Down
3 changes: 2 additions & 1 deletion lib/transports/websocket/hybi-16.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ WebSocket.prototype.protocolVersion = '16';
WebSocket.prototype.onSocketConnect = function () {
var self = this;

if (this.req.headers.upgrade.toLowerCase() !== 'websocket') {
if (typeof this.req.headers.upgrade === 'undefined' ||
this.req.headers.upgrade.toLowerCase() !== 'websocket') {
this.log.warn(this.name + ' connection invalid');
this.end();
return;
Expand Down

0 comments on commit 92a3cce

Please sign in to comment.