diff --git a/lib/manager.js b/lib/manager.js index ee2bf49271..84fcbbf6dd 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -775,6 +775,7 @@ Manager.prototype.handleHandshake = function (data, req, res) { res.writeHead(200, { 'Content-Type': 'application/javascript' }); res.end('io.j[' + data.query.jsonp + '](new Error("' + message + '"));'); } else { + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.writeHead(status); res.end(message); } @@ -808,7 +809,7 @@ Manager.prototype.handleHandshake = function (data, req, res) { hs = 'io.j[' + data.query.jsonp + '](' + JSON.stringify(hs) + ');'; res.writeHead(200, { 'Content-Type': 'application/javascript' }); } else { - res.writeHead(200); + res.writeHead(200, { 'Content-Type': 'text/plain' }); } res.end(hs); diff --git a/lib/transports/websocket/default.js b/lib/transports/websocket/default.js index 092729d923..a05c9203da 100644 --- a/lib/transports/websocket/default.js +++ b/lib/transports/websocket/default.js @@ -176,9 +176,9 @@ WebSocket.prototype.write = function (data) { var length = Buffer.byteLength(data) , buffer = new Buffer(2 + length); - buffer.write('\u0000', 'binary'); + buffer.write('\x00', 'binary'); buffer.write(data, 1, 'utf8'); - buffer.write('\uffff', 1 + length, 'binary'); + buffer.write('\xff', 1 + length, 'binary'); try { if (this.socket.write(buffer)) { diff --git a/lib/transports/websocket/hybi-07-12.js b/lib/transports/websocket/hybi-07-12.js index f09ebb2464..8760a9e63e 100644 --- a/lib/transports/websocket/hybi-07-12.js +++ b/lib/transports/websocket/hybi-07-12.js @@ -139,9 +139,9 @@ WebSocket.prototype.write = function (data) { */ WebSocket.prototype.frame = function (opcode, str) { - var dataBuffer = new Buffer(str); - var dataLength = dataBuffer.length; - var startOffset = 2 + var dataBuffer = new Buffer(str) + , dataLength = dataBuffer.length + , startOffset = 2 , secondByte = dataLength; if (dataLength > 65536) { startOffset = 10;