Skip to content

Commit f1963a7

Browse files
Releasing version 1.3.1
1 parent 7ce822e commit f1963a7

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this package will be documented in this file.
44

5+
## [1.3.1] - 2020-06-29
6+
### Fixed:
7+
- Incorporated [a fix](https://github.com/EventSource/eventsource/pull/130) from the upstream repository that avoids unnecessary delays when parsing a long message that is received in multiple chunks.
8+
59
## [1.3.0] - 2020-04-23
610
### Added:
711
- A Node.js `http.Agent` can be specified using the `agent` option.

example/eventsource-polyfill.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -6666,6 +6666,8 @@ function EventSource (url, eventSourceInitDict) {
66666666
// Source/WebCore/page/EventSource.cpp
66676667
var isFirst = true
66686668
var buf
6669+
var startingPos = 0
6670+
var startingFieldLength = -1
66696671
res.on('data', function (chunk) {
66706672
buf = buf ? Buffer.concat([buf, chunk]) : chunk
66716673
if (isFirst && hasBom(buf)) {
@@ -6685,10 +6687,10 @@ function EventSource (url, eventSourceInitDict) {
66856687
}
66866688

66876689
var lineLength = -1
6688-
var fieldLength = -1
6690+
var fieldLength = startingFieldLength
66896691
var c
66906692

6691-
for (var i = pos; lineLength < 0 && i < length; ++i) {
6693+
for (var i = startingPos; lineLength < 0 && i < length; ++i) {
66926694
c = buf[i]
66936695
if (c === colon) {
66946696
if (fieldLength < 0) {
@@ -6703,7 +6705,12 @@ function EventSource (url, eventSourceInitDict) {
67036705
}
67046706

67056707
if (lineLength < 0) {
6708+
startingPos = length - pos
6709+
startingFieldLength = fieldLength
67066710
break
6711+
} else {
6712+
startingPos = 0
6713+
startingFieldLength = -1
67076714
}
67086715

67096716
parseEventStreamLine(buf, pos, fieldLength, lineLength)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "launchdarkly-eventsource",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Fork of eventsource package - W3C compliant EventSource client for Node.js and browser (polyfill)",
55
"keywords": [
66
"eventsource",

0 commit comments

Comments
 (0)