Skip to content

Commit

Permalink
Add missing Sec-WebSocket-Protocol header to hybi protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokaiser committed Mar 10, 2012
1 parent 8dc184f commit 5093e49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/protocols/hybi-07-12.js
Expand Up @@ -123,6 +123,11 @@ WebSocket.prototype.onOpen = function () {
, 'Sec-WebSocket-Accept: ' + key
];

if (this.req.headers['sec-websocket-protocol']){
headers.push('Sec-WebSocket-Protocol: '
+ this.req.headers['sec-websocket-protocol']);
}

try {
this.socket.write(headers.concat('', '').join('\r\n'));
this.socket.setTimeout(0);
Expand Down
5 changes: 5 additions & 0 deletions lib/protocols/hybi-16.js
Expand Up @@ -125,6 +125,11 @@ WebSocket.prototype.onOpen = function () {
, 'Sec-WebSocket-Accept: ' + key
];

if (this.req.headers['sec-websocket-protocol']){
headers.push('Sec-WebSocket-Protocol: '
+ this.req.headers['sec-websocket-protocol']);
}

try {
this.socket.write(headers.concat('', '').join('\r\n'));
this.socket.setTimeout(0);
Expand Down

0 comments on commit 5093e49

Please sign in to comment.