Skip to content

Commit

Permalink
Merge pull request socketio#622 from mattrobenolt/master
Browse files Browse the repository at this point in the history
Location mismatch in Safari behind proxy
  • Loading branch information
rauchg committed Dec 5, 2011
2 parents 94d513c + 36fc7b0 commit cc2270b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function Manager (server, options) {
, 'browser client gzip': false
, 'browser client handler': false
, 'client store expiration': 15
, 'match origin protocol': false
};

for (var i in options) {
Expand Down
6 changes: 4 additions & 2 deletions lib/transports/websocket/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ WebSocket.prototype.onSocketConnect = function () {
return;
}

var origin = this.req.headers.origin
, location = (this.socket.encrypted ? 'wss' : 'ws')
var origin = this.req.headers['origin']
, location = ((this.manager.settings['match origin protocol'] ?
origin.match(/^https/) : this.socket.encrypted) ?
'wss' : 'ws')
+ '://' + this.req.headers.host + this.req.url
, waitingForNonce = false;

Expand Down
4 changes: 3 additions & 1 deletion lib/transports/websocket/hybi-07-12.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ WebSocket.prototype.onSocketConnect = function () {
}

var origin = this.req.headers['sec-websocket-origin']
, location = (this.socket.encrypted ? 'wss' : 'ws')
, location = ((this.manager.settings['match origin protocol'] ?
origin.match(/^https/) : this.socket.encrypted) ?
'wss' : 'ws')
+ '://' + this.req.headers.host + this.req.url;

if (!this.verifyOrigin(origin)) {
Expand Down
4 changes: 3 additions & 1 deletion lib/transports/websocket/hybi-16.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ WebSocket.prototype.onSocketConnect = function () {
}

var origin = this.req.headers['origin']
, location = (this.socket.encrypted ? 'wss' : 'ws')
, location = ((this.manager.settings['match origin protocol'] ?
origin.match(/^https/) : this.socket.encrypted) ?
'wss' : 'ws')
+ '://' + this.req.headers.host + this.req.url;

if (!this.verifyOrigin(origin)) {
Expand Down

0 comments on commit cc2270b

Please sign in to comment.