Skip to content

Commit

Permalink
I continued to have websocket connection issues in Safari when using …
Browse files Browse the repository at this point in the history
…SSL that terminated at a load balancer. The shorthand logic that was here was nice and compact but didn't seem to work. Took the "intent" of the short hand and made it a bit more verbose and now it works.
  • Loading branch information
jaredbuttars committed May 2, 2012
1 parent de1afe1 commit ffa8994
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/transports/websocket/default.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*!
* socket.io-node
* Copyright(c) 2011 LearnBoost <[email protected]>
Expand Down Expand Up @@ -89,11 +88,14 @@ WebSocket.prototype.onSocketConnect = function () {
}

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;
, waitingForNonce = false;
if(this.manager.settings['match origin protocol']){
location = (origin.indexOf('https')>-1 ? 'wss' : 'ws') + '://' + this.req.headers.host + this.req.url;
}else if(this.socket.encrypted){
location = 'wss://' + this.req.headers.host + this.req.url;
}else{
location = 'ws://' + this.req.headers.host + this.req.url;
}

if (this.req.headers['sec-websocket-key1']) {
// If we don't have the nonce yet, wait for it (HAProxy compatibility).
Expand Down

0 comments on commit ffa8994

Please sign in to comment.