Skip to content

Commit

Permalink
Merge pull request #501 from einaros/master
Browse files Browse the repository at this point in the history
Fixes issue commented on in #377
  • Loading branch information
rauchg committed Aug 31, 2011
2 parents 2c5fa40 + bd360a1 commit 7c196f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/transports/websocket/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions lib/transports/websocket/hybi-07-12.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7c196f5

Please sign in to comment.