Skip to content

Commit

Permalink
Support for resources that include slashes. Thanks @schamane
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Dec 24, 2010
1 parent 45f1712 commit 2853507
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/socket.io/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ Listener.prototype.broadcast = function(message, except){
Listener.prototype.check = function(req, res, httpUpgrade, head){
var path = url.parse(req.url).pathname, parts, cn;
if (path && path.indexOf('/' + this.options.resource) === 0){
parts = path.substr(1).split('/');
if (this._serveClient(parts.slice(1).join('/'), req, res)) return true;
if (!(parts[1] in transports)) return false;
if (parts[2]){
cn = this.clients[parts[2]];
parts = path.substr(2 + this.options.resource.length).split('/');
if (this._serveClient(parts.join('/'), req, res)) return true;
if (!(parts[0] in transports)) return false;
if (parts[1]){
cn = this.clients[parts[1]];
if (cn){
cn._onConnect(req, res);
} else {
req.connection.end();
req.connection.destroy();
this.options.log('Couldnt find client with session id "' + parts[2] + '"');
this.options.log('Couldnt find client with session id "' + parts[1] + '"');
}
} else {
this._onConnection(parts[1], req, res, httpUpgrade, head);
this._onConnection(parts[0], req, res, httpUpgrade, head);
}
return true;
}
Expand Down

0 comments on commit 2853507

Please sign in to comment.