Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add missing Sec-WebSocket-Protocol header to hybi protocols

  • Loading branch information...
commit 5093e4946c8b8ea2f114d9e1d6b43a4bd1a8a701 1 parent 8dc184f
@nicokaiser nicokaiser authored
Showing with 10 additions and 0 deletions.
  1. +5 −0 lib/protocols/hybi-07-12.js
  2. +5 −0 lib/protocols/hybi-16.js
View
5 lib/protocols/hybi-07-12.js
@@ -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);
View
5 lib/protocols/hybi-16.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.