Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

faye-websocket

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faye-websocket - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.redcar/lucene_last_updated

5

lib/faye/websocket.js

@@ -58,6 +58,5 @@ // API and protocol references:

});
this._stream.addListener('close', function() {
self.close(1006, '', false);
['close', 'end', 'error'].forEach(function(event) {
self._stream.addListener(event, function() { self.close(1006, '', false) });
});
this._stream.addListener('error', function() {});
};

@@ -64,0 +63,0 @@

@@ -19,11 +19,8 @@ var Draft75Parser = function(webSocket, stream) {

try {
stream.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n');
stream.write('Upgrade: WebSocket\r\n');
stream.write('Connection: Upgrade\r\n');
stream.write('WebSocket-Origin: ' + this._socket.request.headers.origin + '\r\n');
stream.write('WebSocket-Location: ' + this._socket.url + '\r\n\r\n');
} catch (e) {
// socket closed while writing
// no handshake sent; client will stop using WebSocket
}
stream.write( 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'Upgrade: WebSocket\r\n' +
'Connection: Upgrade\r\n' +
'WebSocket-Origin: ' + this._socket.request.headers.origin + '\r\n' +
'WebSocket-Location: ' + this._socket.url + '\r\n\r\n');
} catch (e) {}
},

@@ -30,0 +27,0 @@

36

lib/faye/websocket/draft76_parser.js

@@ -31,2 +31,21 @@ var crypto = require('crypto'),

var request = this._socket.request,
stream = this._stream;
try {
stream.write( 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'Upgrade: WebSocket\r\n' +
'Connection: Upgrade\r\n' +
'Sec-WebSocket-Origin: ' + request.headers.origin + '\r\n' +
'Sec-WebSocket-Location: ' + this._socket.url + '\r\n\r\n',
'binary');
} catch (e) {}
this.handshakeSignature(head);
};
Draft76Parser.prototype.handshakeSignature = function(head) {
if (head.length === 0) return;
this._handshakeComplete = true;
var request = this._socket.request,
stream = this._stream,

@@ -47,15 +66,14 @@

try {
stream.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n', 'binary');
stream.write('Upgrade: WebSocket\r\n', 'binary');
stream.write('Connection: Upgrade\r\n', 'binary');
stream.write('Sec-WebSocket-Origin: ' + request.headers.origin + '\r\n', 'binary');
stream.write('Sec-WebSocket-Location: ' + this._socket.url + '\r\n\r\n', 'binary');
stream.write(MD5.digest('binary'), 'binary');
} catch (e) {
// socket closed while writing
// no handshake sent; client will stop using WebSocket
}
} catch (e) {};
};
Draft76Parser.prototype.parse = function(data) {
if (this._handshakeComplete)
return Draft75Parser.prototype.parse.call(this, data);
this.handshakeSignature(data);
};
module.exports = Draft76Parser;

@@ -46,9 +46,8 @@ var crypto = require('crypto');

try {
stream.write('GET ' + u.pathname + (u.search || '') + ' HTTP/1.1\r\n');
stream.write('Host: ' + u.hostname + (u.port ? ':' + u.port : '') + '\r\n');
stream.write('Upgrade: websocket\r\n');
stream.write('Connection: Upgrade\r\n');
stream.write('Sec-WebSocket-Key: ' + this._key + '\r\n');
stream.write('Sec-WebSocket-Version: 8\r\n');
stream.write('\r\n');
stream.write( 'GET ' + u.pathname + (u.search || '') + ' HTTP/1.1\r\n' +
'Host: ' + u.hostname + (u.port ? ':' + u.port : '') + '\r\n' +
'Upgrade: websocket\r\n' +
'Connection: Upgrade\r\n' +
'Sec-WebSocket-Key: ' + this._key + '\r\n' +
'Sec-WebSocket-Version: 8\r\n\r\n');
} catch (e) {}

@@ -140,10 +139,7 @@ };

try {
stream.write('HTTP/1.1 101 Switching Protocols\r\n');
stream.write('Upgrade: websocket\r\n');
stream.write('Connection: Upgrade\r\n');
stream.write('Sec-WebSocket-Accept: ' + accept + '\r\n\r\n');
} catch (e) {
// socket closed while writing
// no handshake sent; client will stop using WebSocket
}
stream.write( 'HTTP/1.1 101 Switching Protocols\r\n' +
'Upgrade: websocket\r\n' +
'Connection: Upgrade\r\n' +
'Sec-WebSocket-Accept: ' + accept + '\r\n\r\n');
} catch (e) {}
},

@@ -150,0 +146,0 @@

@@ -7,3 +7,3 @@ { "name" : "faye-websocket"

, "version" : "0.1.1"
, "version" : "0.1.2"
, "engines" : {"node": ">=0.4.0"}

@@ -10,0 +10,0 @@ , "main" : "./lib/faye/websocket"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc