diff --git a/contract-tests/Gemfile b/contract-tests/Gemfile index 5bf3d7c4..e70f6008 100644 --- a/contract-tests/Gemfile +++ b/contract-tests/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' gem 'launchdarkly-server-sdk', path: '..' -gem 'http', '~> 5.1' +gem 'http', '>= 5.1', '< 7.0' gem 'json' gem "puma", "~> 6.6" gem "rackup", "~> 2.2" diff --git a/launchdarkly-server-sdk.gemspec b/launchdarkly-server-sdk.gemspec index 0bed3f26..25ba2f96 100644 --- a/launchdarkly-server-sdk.gemspec +++ b/launchdarkly-server-sdk.gemspec @@ -42,7 +42,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "benchmark", "~> 0.1", ">= 0.1.1" spec.add_runtime_dependency "concurrent-ruby", "~> 1.1" - spec.add_runtime_dependency "ld-eventsource", "2.5.1" + spec.add_runtime_dependency "ld-eventsource", "2.6.0" spec.add_runtime_dependency "observer", "~> 0.1.2" spec.add_runtime_dependency "openssl", ">= 3.1.2", "< 5.0" spec.add_runtime_dependency "semantic", "~> 1.6" @@ -50,6 +50,6 @@ Gem::Specification.new do |spec| # Please keep ld-eventsource dependency as an exact version so that bugfixes to # that LD library are always associated with a new SDK version. - spec.add_runtime_dependency "http", ">= 4.4.0", "< 6.0.0" + spec.add_runtime_dependency "http", ">= 4.4.0", "< 7.0.0" spec.add_runtime_dependency "json", "~> 2.3" end diff --git a/lib/ldclient-rb/impl/data_source/requestor.rb b/lib/ldclient-rb/impl/data_source/requestor.rb index 9bf81417..f1e714f5 100644 --- a/lib/ldclient-rb/impl/data_source/requestor.rb +++ b/lib/ldclient-rb/impl/data_source/requestor.rb @@ -64,9 +64,7 @@ def make_request(path) unless cached.nil? headers["If-None-Match"] = cached.etag end - response = @http_client.request("GET", uri, { - headers: headers, - }) + response = @http_client.request("GET", uri, headers: headers) status = response.status.code # must fully read body for persistent connections body = response.to_s diff --git a/lib/ldclient-rb/impl/event_sender.rb b/lib/ldclient-rb/impl/event_sender.rb index 660c7df7..f98703d4 100644 --- a/lib/ldclient-rb/impl/event_sender.rb +++ b/lib/ldclient-rb/impl/event_sender.rb @@ -67,10 +67,7 @@ def send_event_data(event_data, description, is_diagnostic) body = gzip.close.string end - response = http_client.request("POST", uri, { - headers: headers, - body: body, - }) + response = http_client.request("POST", uri, headers: headers, body: body) rescue StandardError => exn @logger.warn { "[LDClient] Error sending events: #{exn.inspect}." } next diff --git a/lib/ldclient-rb/impl/util.rb b/lib/ldclient-rb/impl/util.rb index 48dc33a1..6748295a 100644 --- a/lib/ldclient-rb/impl/util.rb +++ b/lib/ldclient-rb/impl/util.rb @@ -127,22 +127,22 @@ def self.add_payload_filter_key(uri, config) def self.new_http_client(http_config) http_client_options = {} if http_config.socket_factory - http_client_options["socket_class"] = http_config.socket_factory + http_client_options[:socket_class] = http_config.socket_factory end proxy = URI.parse(http_config.base_uri).find_proxy unless proxy.nil? - http_client_options["proxy"] = { + http_client_options[:proxy] = { proxy_address: proxy.host, proxy_port: proxy.port, proxy_username: proxy.user, proxy_password: proxy.password, } end - HTTP::Client.new(http_client_options) - .timeout({ + HTTP::Client.new(**http_client_options) + .timeout( read: http_config.read_timeout, - connect: http_config.connect_timeout, - }) + connect: http_config.connect_timeout + ) .persistent(http_config.base_uri) end