ld-eventsource 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76ed80d3fefe60b6a147769dc1b44b0dfd7fe5b6841ff84655ae86764def70b9
4
- data.tar.gz: cf24cff61716e4487d74023e09be18a516232a198aabcda2742fb8ec8de9de72
3
+ metadata.gz: b3ce08e7a1cf60a7a5dbbe1dfdaa98c4391a625a05b91e47907e80f02ad5a301
4
+ data.tar.gz: 35009bae9547b7db1bfbd9e4561e58594d6471d44b379436e43d78894fbcfb6e
5
5
  SHA512:
6
- metadata.gz: 329c044114376d9d618e37a138b7c99dc5c4f00baa3d22ea72ce88309deec8bd22a62c0513a362223542f9ddfa5aaae0413e14bbf336ef943a90e0374d2d9c89
7
- data.tar.gz: 9110b5daa08a3c7fb04bb432527feaf4bee5e67d02b215621c89546ffd0a4da98c14a9618cdf4040474afe1649db777996547bfb502512930a3b364f05dd57c1
6
+ metadata.gz: a7c0915fddc58ed5629eda81b30b7d843a7689ae58ebe01e45f0451d125aa4033d8ad47f50832645b64a97662155cd9ff0e2fa077fc269a604f9bc6ef8a5a27d
7
+ data.tar.gz: 0a0b2dc61b40ec7b48d32ff3449a70712d9e1ea17e2708eb62d7fce68b5f61d722709d6b244efdf908c47d6ed43cc0e70eec8fe80006478658ce3838f837737a
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  LaunchDarkly SSE Client for Ruby
2
2
  ================================
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/ld-eventsource.svg)](http://badge.fury.io/rb/ld-eventsource) [![Circle CI](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/master.svg?style=svg)](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/master)
4
+ [![Gem Version](https://badge.fury.io/rb/ld-eventsource.svg)](http://badge.fury.io/rb/ld-eventsource) [![Circle CI](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/main.svg?style=svg)](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/main)
5
5
 
6
6
  A client for the [Server-Sent Events](https://www.w3.org/TR/eventsource/) protocol. This implementation runs on a worker thread, and uses the [`http`](https://rubygems.org/gems/http) gem to manage a persistent connection. Its primary purpose is to support the [LaunchDarkly SDK for Ruby](https://github.com/launchdarkly/ruby-client), but it can be used independently.
7
7
 
@@ -37,12 +37,15 @@ module SSE
37
37
  event = maybe_create_event
38
38
  reset_buffers
39
39
  gen.yield event if !event.nil?
40
- else
41
- case line
42
- when /^(\w+): ?(.*)$/
43
- item = process_field($1, $2)
44
- gen.yield item if !item.nil?
45
- end
40
+ elsif (pos = line.index(':'))
41
+ name = line.slice(0...pos)
42
+
43
+ pos += 1 # skip colon
44
+ pos += 1 if pos < line.length && line[pos] == ' ' # skip optional single space, per SSE spec
45
+ line = line.slice(pos..-1)
46
+
47
+ item = process_field(name, line)
48
+ gen.yield item if !item.nil?
46
49
  end
47
50
  end
48
51
  end
@@ -62,8 +65,11 @@ module SSE
62
65
  when "event"
63
66
  @type = value.to_sym
64
67
  when "data"
65
- @data << "\n" if @have_data
66
- @data << value
68
+ if @have_data
69
+ @data << "\n" << value
70
+ else
71
+ @data = value
72
+ end
67
73
  @have_data = true
68
74
  when "id"
69
75
  if !value.include?("\x00")
@@ -1,3 +1,3 @@
1
1
  module SSE
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ld-eventsource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LaunchDarkly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-31 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 3.3.4
139
+ rubygems_version: 3.3.16
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: LaunchDarkly SSE client