Socket
Socket
Sign inDemoInstall

faye-websocket

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.2 to 0.4.3

6

CHANGELOG.txt

@@ -0,1 +1,7 @@

=== 0.4.3 / 2012-07-09
* Add 'Connection: close' to EventSource response
* Handle situations where request.socket is undefined
=== 0.4.2 / 2012-04-06

@@ -2,0 +8,0 @@

15

lib/faye/eventsource.js

@@ -22,5 +22,2 @@ var API = require('./websocket/api'),

this._stream.setTimeout(0);
this._stream.setNoDelay(true);
var scheme = isSecureConnection(request) ? 'https:' : 'http:';

@@ -39,9 +36,6 @@ this.url = scheme + '//' + request.headers.host + request.url;

'Cache-Control: no-cache, no-store\r\n' +
'Connection: close\r\n' +
'\r\n\r\n' +
'retry: ' + Math.floor(this._retry * 1000) + '\r\n\r\n';
try {
this._stream.write(handshake, 'utf8');
} catch (e) {}
this.readyState = API.OPEN;

@@ -52,2 +46,9 @@

if (!this._stream || !this._stream.writable) return;
this._stream.setTimeout(0);
this._stream.setNoDelay(true);
try { this._stream.write(handshake, 'utf8') } catch (e) {}
['close', 'end', 'error'].forEach(function(event) {

@@ -54,0 +55,0 @@ self._stream.addListener(event, function() { self.close() });

@@ -40,5 +40,2 @@ // API and protocol references:

this._stream.setTimeout(0);
this._stream.setNoDelay(true);
var scheme = isSecureConnection(request) ? 'wss:' : 'ws:';

@@ -57,4 +54,2 @@ this.url = scheme + '//' + request.headers.host + request.url;

var handshake = this._parser.handshakeResponse(head);
try { this._stream.write(handshake, 'binary') } catch (e) {}
if (this._parser.isOpen()) this.readyState = API.OPEN;

@@ -71,2 +66,9 @@

if (!this._stream || !this._stream.writable) return;
this._stream.setTimeout(0);
this._stream.setNoDelay(true);
try { this._stream.write(handshake, 'binary') } catch (e) {}
this._stream.addListener('data', function(data) {

@@ -73,0 +75,0 @@ var response = self._parser.parse(data);

@@ -66,3 +66,3 @@ var EventTarget = require('./api/event_target'),

if (this._pingLoop) clearInterval(this._pingLoop);
this._stream.end();
if (this._stream) this._stream.end();
var event = new Event('close', {code: code || 1000, reason: reason || ''});

@@ -69,0 +69,0 @@ event.initEvent('close', false, false);

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

, "version" : "0.4.2"
, "version" : "0.4.3"
, "engines" : {"node": ">=0.4.0"}

@@ -17,9 +17,9 @@ , "main" : "./lib/faye/websocket"

, "licenses" : [ { "type" : "MIT"
, "url" : "http://www.opensource.org/licenses/mit-license.php"
, "licenses" : [ { "type" : "MIT"
, "url" : "http://www.opensource.org/licenses/mit-license.php"
}
]
, "repositories" : [ { "type" : "git"
, "url" : "git://github.com/faye/faye-websocket-node.git"
, "repositories" : [ { "type" : "git"
, "url" : "git://github.com/faye/faye-websocket-node.git"
}

@@ -26,0 +26,0 @@ ]

@@ -140,11 +140,2 @@ var HybiParser = require('../../../lib/faye/websocket/hybi_parser')

it("encodes long strings using extra length bytes", function() { with(this) {
var reps = 13108, message = '', output = [0x81, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04]
while (reps--) {
message += "Hello"
output = output.concat([0x48, 0x65, 0x6c, 0x6c, 0x6f])
}
assertBufferEqual( output, parser.frame(message) )
}})
it("encodes close frames with an error code", function() { with(this) {

@@ -151,0 +142,0 @@ assertBufferEqual( [0x88, 0x07, 0x03, 0xea, 0x48, 0x65, 0x6c, 0x6c, 0x6f], parser.frame("Hello", "close", 1002) )

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc