Socket
Socket
Sign inDemoInstall

eventsource

Package Overview
Dependencies
4
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.7 to 1.1.0

9

HISTORY.md

@@ -0,1 +1,10 @@

# [1.1.0](https://github.com/EventSource/eventsource/compare/v1.0.7...v1.1.0)
* Improve performance for large messages across many chunks ([#130](https://github.com/EventSource/eventsource/pull/130) Trent Willis)
* Add `createConnection` option for http or https requests ([#120](https://github.com/EventSource/eventsource/pull/120) Vasily Lavrov)
* Support HTTP 302 redirects ([#116](https://github.com/EventSource/eventsource/pull/116) Ryan Bonte)
* Prevent sequential errors from attempting multiple reconnections ([#125](https://github.com/EventSource/eventsource/pull/125) David Patty)
* Add `new` to correct test ([#111](https://github.com/EventSource/eventsource/pull/101) Stéphane Alnet)
* Fix reconnections attempts now happen more than once ([#136](https://github.com/EventSource/eventsource/pull/136) Icy Fish)
# [1.0.7](https://github.com/EventSource/eventsource/compare/v1.0.6...v1.0.7)

@@ -2,0 +11,0 @@

23

lib/eventsource.js

@@ -48,2 +48,3 @@ var original = require('original')

self.reconnectInterval = 1000
self.connectionInProgress = false

@@ -62,5 +63,6 @@ function onConnectionClosed (message) {

setTimeout(function () {
if (readyState !== EventSource.CONNECTING) {
if (readyState !== EventSource.CONNECTING || self.connectionInProgress) {
return
}
self.connectionInProgress = true
connect()

@@ -101,2 +103,6 @@ }, self.reconnectInterval)

if (eventSourceInitDict && eventSourceInitDict.createConnection !== undefined) {
options.createConnection = eventSourceInitDict.createConnection
}
// If specify http proxy, make the request to sent to the proxy server,

@@ -137,2 +143,3 @@ // and include the original url in path and Host headers

req = (isSecure ? https : http).request(options, function (res) {
self.connectionInProgress = false
// Handle HTTP errors

@@ -146,3 +153,3 @@ if (res.statusCode === 500 || res.statusCode === 502 || res.statusCode === 503 || res.statusCode === 504) {

// Handle HTTP redirects
if (res.statusCode === 301 || res.statusCode === 307) {
if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {
if (!res.headers.location) {

@@ -182,2 +189,4 @@ // Server sent redirect response without Location header.

var buf
var startingPos = 0
var startingFieldLength = -1
res.on('data', function (chunk) {

@@ -202,6 +211,6 @@ buf = buf ? Buffer.concat([buf, chunk]) : chunk

var lineLength = -1
var fieldLength = -1
var fieldLength = startingFieldLength
var c
for (var i = pos; lineLength < 0 && i < length; ++i) {
for (var i = startingPos; lineLength < 0 && i < length; ++i) {
c = buf[i]

@@ -221,3 +230,8 @@ if (c === colon) {

if (lineLength < 0) {
startingPos = length - pos
startingFieldLength = fieldLength
break
} else {
startingPos = 0
startingFieldLength = -1
}

@@ -239,2 +253,3 @@

req.on('error', function (err) {
self.connectionInProgress = false
onConnectionClosed(err.message)

@@ -241,0 +256,0 @@ })

2

package.json
{
"name": "eventsource",
"version": "1.0.7",
"version": "1.1.0",
"description": "W3C compliant EventSource client for Node.js and browser (polyfill)",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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