ld-eventsource 2.2.1 → 2.2.2

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: b3ce08e7a1cf60a7a5dbbe1dfdaa98c4391a625a05b91e47907e80f02ad5a301
4
- data.tar.gz: 35009bae9547b7db1bfbd9e4561e58594d6471d44b379436e43d78894fbcfb6e
3
+ metadata.gz: 218cc36d5dda460be0004eb338d39d5ebeeeed75c5d12150bc8374c1fcc59ebf
4
+ data.tar.gz: f5da16ee1ae0277e069b6f94f5ff133dd119cb247196b810bf517fb3831a8118
5
5
  SHA512:
6
- metadata.gz: a7c0915fddc58ed5629eda81b30b7d843a7689ae58ebe01e45f0451d125aa4033d8ad47f50832645b64a97662155cd9ff0e2fa077fc269a604f9bc6ef8a5a27d
7
- data.tar.gz: 0a0b2dc61b40ec7b48d32ff3449a70712d9e1ea17e2708eb62d7fce68b5f61d722709d6b244efdf908c47d6ed43cc0e70eec8fe80006478658ce3838f837737a
6
+ metadata.gz: eee2596eb7bb33f476b969a03908a414705fbcc237afa246d2e6057933ac3ccb56aa4416f810ead64cc1b1ff33bcc326798a2d703cc96bdd2c270bcc1a0fccde
7
+ data.tar.gz: ce9da2a43a93d3eba73eafdce1070c4f049dc99fc7522c28c7fbb4f37b5a8ab0ca3f4a7866c66c29c739f5056b192fb08aad87a22e242e92cda9679c89281d28
@@ -85,7 +85,7 @@ module SSE
85
85
  # if you want to use something other than the default `TCPSocket`; it must implement
86
86
  # `open(uri, timeout)` to return a connected `Socket`
87
87
  # @yieldparam [Client] client the new client instance, before opening the connection
88
- #
88
+ #
89
89
  def initialize(uri,
90
90
  headers: {},
91
91
  connect_timeout: DEFAULT_CONNECT_TIMEOUT,
@@ -107,7 +107,7 @@ module SSE
107
107
  if socket_factory
108
108
  http_client_options["socket_class"] = socket_factory
109
109
  end
110
-
110
+
111
111
  if proxy
112
112
  @proxy = proxy
113
113
  else
@@ -202,12 +202,12 @@ module SSE
202
202
  end
203
203
 
204
204
  private
205
-
205
+
206
206
  def reset_http
207
207
  @http_client.close if !@http_client.nil?
208
208
  close_connection
209
209
  end
210
-
210
+
211
211
  def close_connection
212
212
  @lock.synchronize do
213
213
  @cxn.connection.close if !@cxn.nil?
@@ -258,7 +258,7 @@ module SSE
258
258
  interval = @first_attempt ? 0 : @backoff.next_interval
259
259
  @first_attempt = false
260
260
  if interval > 0
261
- @logger.info { "Will retry connection after #{'%.3f' % interval} seconds" }
261
+ @logger.info { "Will retry connection after #{'%.3f' % interval} seconds" }
262
262
  sleep(interval)
263
263
  end
264
264
  cxn = nil
@@ -268,14 +268,14 @@ module SSE
268
268
  headers: build_headers
269
269
  })
270
270
  if cxn.status.code == 200
271
- content_type = cxn.headers["content-type"]
271
+ content_type = cxn.content_type.mime_type
272
272
  if content_type && content_type.start_with?("text/event-stream")
273
273
  return cxn # we're good to proceed
274
274
  else
275
275
  reset_http
276
- err = Errors::HTTPContentTypeError.new(cxn.headers["content-type"])
276
+ err = Errors::HTTPContentTypeError.new(content_type)
277
277
  @on[:error].call(err)
278
- @logger.warn { "Event source returned unexpected content type '#{cxn.headers["content-type"]}'" }
278
+ @logger.warn { "Event source returned unexpected content type '#{content_type}'" }
279
279
  end
280
280
  else
281
281
  body = cxn.to_s # grab the whole response body in case it has error details
@@ -309,7 +309,7 @@ module SSE
309
309
  # readpartial gives us a string, which may not be a valid UTF-8 string because a
310
310
  # multi-byte character might not yet have been fully read, but BufferedLineReader
311
311
  # will handle that.
312
- rescue HTTP::TimeoutError
312
+ rescue HTTP::TimeoutError
313
313
  # For historical reasons, we rethrow this as our own type
314
314
  raise Errors::ReadTimeoutError.new(@read_timeout)
315
315
  end
@@ -344,7 +344,7 @@ module SSE
344
344
  @logger.warn { "#{message}: #{e.inspect}"}
345
345
  @logger.debug { "Exception trace: #{e.backtrace}" }
346
346
  begin
347
- @on[:error].call(e)
347
+ @on[:error].call(e)
348
348
  rescue StandardError => ee
349
349
  @logger.warn { "Error handler threw an exception: #{ee.inspect}"}
350
350
  @logger.debug { "Exception trace: #{ee.backtrace}" }
@@ -1,3 +1,3 @@
1
1
  module SSE
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
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.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - LaunchDarkly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-15 00:00:00.000000000 Z
11
+ date: 2023-03-13 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.16
139
+ rubygems_version: 3.4.8
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: LaunchDarkly SSE client