splitclient-rb 7.3.5.pre.rc3-java → 8.0.0.pre.rc1-java

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
  SHA1:
3
- metadata.gz: 186060ea5e282d91426d8c220d060fe34cf8a316
4
- data.tar.gz: 2217aae3d87f3dd8ba0a09128ba5d7a064fb1fae
3
+ metadata.gz: 3361d3010afe34c3f431e3acea95c91dacf6a835
4
+ data.tar.gz: 13e9c1f8f7b32a9769ab474934c34c844636fbff
5
5
  SHA512:
6
- metadata.gz: e3e69c550554845b3b27ae2132a86c25e2d2f0b49c001baacdea33feec117f8ce5778ff004ccfe44388841b384d9a086db43eeb89997e2159503361adda3525b
7
- data.tar.gz: fdc0ec71a389b8f48f9d941cca7bf2571d3e91cd85ee0f1ac03413e53ac8ea4367eb5d8d00b414c5649262f88cba4be8e70726d38d67cbf2f0a8c813ee830fa6
6
+ metadata.gz: 4f0d7bc586a3452dceeadad1aa70f662ff789ff6c8fdfeb879772dd8e92a1d37f7c81d78eb78ce27dfdb6d57a25f1daed9556c790733f7d8423f6e606cfdd6b5
7
+ data.tar.gz: 3fe42c3ebfaf805648381194f882d063a2b02027c21d428ada11eee2eb5273a8f97b632cb024b4d645d28a358dc60c25d8fa3cd5af88f1c452168c889d5d3783
@@ -1,10 +1,4 @@
1
- on:
2
- push:
3
- branches:
4
- - master
5
- pull_request:
6
- branches:
7
- - master
1
+ on: [push, pull_request]
8
2
 
9
3
  jobs:
10
4
  test:
@@ -21,7 +15,7 @@ jobs:
21
15
  fetch-depth: 0
22
16
 
23
17
  - name: Set up Ruby
24
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
18
+ uses: ruby/setup-ruby@v1
25
19
  with:
26
20
  ruby-version: 2.5
27
21
 
data/.rubocop.yml CHANGED
@@ -52,7 +52,7 @@ Naming/FileName:
52
52
  - splitclient-rb.gemspec
53
53
 
54
54
  AllCops:
55
- TargetRubyVersion: 2.3.6
55
+ TargetRubyVersion: 2.5
56
56
  Exclude:
57
57
  - gemfiles/* # excluded as appraisal generates them with errors
58
58
  - lib/*
data/Rakefile CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
5
  require 'rubocop/rake_task'
6
- require 'appraisal'
7
6
 
8
7
  Dir['tasks/**/*.rake'].each { |rake| load rake }
9
8
 
@@ -26,10 +25,4 @@ else
26
25
  end
27
26
  end
28
27
 
29
- if !ENV['APPRAISAL_INITIALIZED']
30
- task :default do
31
- sh 'appraisal install && rake appraisal && rake rubocop'
32
- end
33
- else
34
- task default: %i[spec rubocop]
35
- end
28
+ task default: %i[spec rubocop]
@@ -31,9 +31,9 @@ module SplitIoClient
31
31
  def uniques_formatter(uniques)
32
32
  return if uniques.nil? || uniques.empty?
33
33
 
34
- to_return = { mtks: [] }
34
+ to_return = { keys: [] }
35
35
  uniques.each do |key, value|
36
- to_return[:mtks] << {
36
+ to_return[:keys] << {
37
37
  f: key,
38
38
  ks: value.to_a
39
39
  }
@@ -29,8 +29,6 @@ module SplitIoClient
29
29
  impressions_count.each do |key, value|
30
30
  pipeline.hincrby(impressions_count_key, key, value)
31
31
  end
32
-
33
- @future = pipeline.hlen(impressions_count_key)
34
32
  end
35
33
 
36
34
  expire_impressions_count_key(impressions_count, result)
@@ -24,7 +24,7 @@ module SplitIoClient
24
24
  sleep(@config.counter_refresh_rate)
25
25
  post_impressions_count
26
26
  end
27
- rescue SplitIoClient::SDKShutdownException
27
+ rescue SplitIoClient::SDKShutdownException
28
28
  post_impressions_count
29
29
 
30
30
  @config.logger.info('Posting impressions count due to shutdown')
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'net/http/persistent'
4
-
5
3
  module SplitIoClient
6
4
  module Api
7
5
  class Client
@@ -54,33 +52,12 @@ module SplitIoClient
54
52
  private
55
53
 
56
54
  def api_client
57
- if needs_patched_net_http_persistent_adapter?
58
- require 'splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent'
59
-
60
- Faraday::Adapter.register_middleware(
61
- net_http_persistent: SplitIoClient::FaradayAdapter::PatchedNetHttpPersistent
62
- )
63
- end
64
-
65
55
  @api_client ||= Faraday.new do |builder|
66
56
  builder.use SplitIoClient::FaradayMiddleware::Gzip
67
57
  builder.adapter :net_http_persistent
68
58
  end
69
59
  end
70
60
 
71
- def needs_patched_net_http_persistent_adapter?
72
- new_net_http_persistent? && incompatible_faraday_version?
73
- end
74
-
75
- def incompatible_faraday_version?
76
- version = Faraday::VERSION.split('.')[0..1]
77
- version[0].to_i == 0 && version[1].to_i < 13
78
- end
79
-
80
- def new_net_http_persistent?
81
- Net::HTTP::Persistent::VERSION.split('.').first.to_i >= 3
82
- end
83
-
84
61
  def common_headers(api_key)
85
62
  {
86
63
  'Authorization' => "Bearer #{api_key}",
@@ -18,9 +18,9 @@ module SplitIoClient
18
18
  end
19
19
 
20
20
  def record_unique_keys(uniques)
21
- return if uniques[:mtks].empty?
21
+ return if uniques[:keys].empty?
22
22
 
23
- post_telemetry("#{@config.telemetry_service_url}/mtks/ss", uniques, 'mtks')
23
+ post_telemetry("#{@config.telemetry_service_url}/keys/ss", uniques, 'unique_keys')
24
24
  rescue StandardError => e
25
25
  @config.log_found_exception(__method__.to_s, e)
26
26
  end
@@ -9,15 +9,13 @@ module SplitIoClient
9
9
  impression_counter,
10
10
  telemetry_runtime_producer,
11
11
  impression_observer,
12
- unique_keys_tracker,
13
- impression_router)
12
+ unique_keys_tracker)
14
13
  @config = config
15
14
  @impressions_repository = impressions_repository
16
15
  @impression_counter = impression_counter
17
16
  @impression_observer = impression_observer
18
17
  @telemetry_runtime_producer = telemetry_runtime_producer
19
18
  @unique_keys_tracker = unique_keys_tracker
20
- @impression_router = impression_router
21
19
  end
22
20
 
23
21
  def build_impression(matching_key, bucketing_key, split_name, treatment, params = {})
@@ -58,12 +56,18 @@ module SplitIoClient
58
56
  @config.log_found_exception(__method__.to_s, e)
59
57
  ensure
60
58
  record_stats(stats)
61
- @impression_router.add_bulk(impressions)
59
+ impression_router.add_bulk(impressions)
62
60
  end
63
61
  end
64
62
 
65
63
  private
66
64
 
65
+ def impression_router
66
+ @impression_router ||= SplitIoClient::ImpressionRouter.new(@config)
67
+ rescue StandardError => error
68
+ @config.log_found_exception(__method__.to_s, error)
69
+ end
70
+
67
71
  def record_stats(stats)
68
72
  return if redis?
69
73
 
@@ -41,17 +41,20 @@ module SplitIoClient
41
41
  private
42
42
 
43
43
  def schedule_next_token_refresh(time)
44
- @config.threads[:schedule_next_token_refresh] = Thread.new do
45
- begin
46
- @config.logger.debug("schedule_next_token_refresh refresh in #{time} seconds.") if @config.debug_enabled
47
- sleep(time)
48
- @config.logger.debug('schedule_next_token_refresh starting ...') if @config.debug_enabled
49
- @sse_handler.stop
50
- start_sse
51
- rescue StandardError => e
52
- @config.logger.debug("schedule_next_token_refresh error: #{e.inspect}") if @config.debug_enabled
53
- end
54
- end
44
+ @config.threads[:schedule_next_token_refresh] = Thread.new { refresh_token_task(time) }
45
+ end
46
+
47
+ def refresh_token_task(time)
48
+ @config.logger.debug("schedule_next_token_refresh refresh in #{time} seconds.") if @config.debug_enabled
49
+
50
+ sleep(time)
51
+
52
+ @config.logger.debug('schedule_next_token_refresh starting ...') if @config.debug_enabled
53
+ @sse_handler.stop
54
+
55
+ start_sse
56
+ rescue StandardError => e
57
+ @config.logger.debug("schedule_next_token_refresh error: #{e.inspect}") if @config.debug_enabled
55
58
  end
56
59
 
57
60
  def record_telemetry(time)
@@ -51,7 +51,7 @@ module SplitIoClient
51
51
 
52
52
  @segments_refresh_rate = opts[:segments_refresh_rate] || SplitConfig.default_segments_refresh_rate
53
53
 
54
- @impressions_mode = init_impressions_mode(opts[:impressions_mode])
54
+ @impressions_mode = init_impressions_mode(opts[:impressions_mode], opts[:cache_adapter])
55
55
 
56
56
  @impressions_refresh_rate = SplitConfig.init_impressions_refresh_rate(@impressions_mode, opts[:impressions_refresh_rate], SplitConfig.default_impressions_refresh_rate)
57
57
  @impressions_queue_size = opts[:impressions_queue_size] || SplitConfig.default_impressions_queue_size
@@ -314,14 +314,16 @@ module SplitIoClient
314
314
  :optimized
315
315
  end
316
316
 
317
- def init_impressions_mode(impressions_mode)
317
+ def init_impressions_mode(impressions_mode, adapter)
318
318
  impressions_mode ||= SplitConfig.default_impressions_mode
319
319
 
320
+ return :debug if adapter == :redis
321
+
320
322
  case impressions_mode
321
323
  when :debug
322
324
  return :debug
323
- when :none
324
- return :none
325
+ # when :none // we not support :none impression mode yet. Defaulting to :optimized mode
326
+ # return :none
325
327
  else
326
328
  @logger.error('You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug or :optimized. Defaulting to :optimized mode') unless impressions_mode == :optimized
327
329
  return :optimized
@@ -65,7 +65,7 @@ module SplitIoClient
65
65
  build_streaming_components
66
66
  build_sync_manager
67
67
 
68
- @sync_manager.start if @config.valid_mode
68
+ @sync_manager.start
69
69
  end
70
70
 
71
71
  def stop!
@@ -127,10 +127,10 @@ module SplitIoClient
127
127
  def validate_api_key
128
128
  if(@api_key.nil?)
129
129
  @config.logger.error('Factory Instantiation: you passed a nil api_key, api_key must be a non-empty String')
130
- @config.valid_mode = false
130
+ @config.valid_mode = false
131
131
  elsif (@api_key.empty?)
132
132
  @config.logger.error('Factory Instantiation: you passed and empty api_key, api_key must be a non-empty String')
133
- @config.valid_mode = false
133
+ @config.valid_mode = false
134
134
  end
135
135
  end
136
136
 
@@ -249,8 +249,7 @@ module SplitIoClient
249
249
  build_impressions_observer
250
250
  build_impression_counter
251
251
 
252
- impression_router = ImpressionRouter.new(@config)
253
- @impressions_manager = Engine::Common::ImpressionManager.new(@config, @impressions_repository, @impression_counter, @runtime_producer, @impression_observer, @unique_keys_tracker, impression_router)
252
+ @impressions_manager = Engine::Common::ImpressionManager.new(@config, @impressions_repository, @impression_counter, @runtime_producer, @impression_observer, @unique_keys_tracker)
254
253
  end
255
254
  end
256
255
  end
@@ -11,12 +11,12 @@ module SplitIoClient
11
11
  def record_config(config_data)
12
12
  return if config_data.nil?
13
13
 
14
- data = { m: { i: @config.machine_ip, n: @config.machine_name, s: "#{@config.language}-#{@config.version}" },
15
- t: { oM: config_data.om, st: config_data.st, aF: config_data.af, rF: config_data.rf, t: config_data.t } }
14
+ data = { t: { oM: config_data.om, st: config_data.st, aF: config_data.af, rF: config_data.rf, t: config_data.t } }
15
+ field = "#{@config.language}-#{@config.version}/#{@config.machine_name}/#{@config.machine_ip}"
16
16
 
17
- @adapter.add_to_queue(config_key, data.to_json)
18
- rescue StandardError => error
19
- @config.log_found_exception(__method__.to_s, error)
17
+ @adapter.add_to_map(config_key, field, data.to_json)
18
+ rescue StandardError => e
19
+ @config.log_found_exception(__method__.to_s, e)
20
20
  end
21
21
 
22
22
  def record_bur_timeout
@@ -30,7 +30,7 @@ module SplitIoClient
30
30
  private
31
31
 
32
32
  def config_key
33
- "#{@config.redis_namespace}.telemetry.config"
33
+ "#{@config.redis_namespace}.telemetry.init"
34
34
  end
35
35
  end
36
36
  end
@@ -15,21 +15,21 @@ module SplitIoClient
15
15
  private
16
16
 
17
17
  def stats_thread
18
- @config.threads[:telemetry_stats_sender] = Thread.new do
19
- begin
20
- @config.logger.info('Starting Telemetry Sync Task')
18
+ @config.threads[:telemetry_stats_sender] = Thread.new { telemetry_sync_task }
19
+ end
21
20
 
22
- loop do
23
- sleep(@config.telemetry_refresh_rate)
21
+ def telemetry_sync_task
22
+ @config.logger.info('Starting Telemetry Sync Task')
24
23
 
25
- @telemetry_synchronizer.synchronize_stats
26
- end
27
- rescue SplitIoClient::SDKShutdownException
28
- @telemetry_synchronizer.synchronize_stats
24
+ loop do
25
+ sleep(@config.telemetry_refresh_rate)
29
26
 
30
- @config.logger.info('Posting Telemetry due to shutdown')
31
- end
27
+ @telemetry_synchronizer.synchronize_stats
32
28
  end
29
+ rescue SplitIoClient::SDKShutdownException
30
+ @telemetry_synchronizer.synchronize_stats
31
+
32
+ @config.logger.info('Posting Telemetry due to shutdown')
33
33
  end
34
34
  end
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '7.3.5.pre.rc3'
2
+ VERSION = '8.0.0.pre.rc1'
3
3
  end
@@ -49,7 +49,6 @@ require 'splitclient-rb/validators'
49
49
  require 'splitclient-rb/split_factory_registry'
50
50
 
51
51
  require 'splitclient-rb/engine/api/faraday_middleware/gzip'
52
- require 'splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent'
53
52
  require 'splitclient-rb/engine/api/client'
54
53
  require 'splitclient-rb/engine/api/impressions'
55
54
  require 'splitclient-rb/engine/api/segments'
@@ -8,16 +8,15 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'splitclient-rb'
9
9
  spec.version = SplitIoClient::VERSION
10
10
  spec.authors = ['Split Software']
11
- spec.email = ['pato@split.io']
12
-
11
+ spec.email = ['mauro.sanz@split.io']
13
12
  spec.summary = 'Ruby client for split SDK.'
14
13
  spec.description = 'Ruby client for using split SDK.'
15
14
  spec.homepage = 'https://github.com/splitio/ruby-client'
16
15
  spec.license = 'Apache-2.0'
17
16
 
18
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features|ext)/}) }
19
-
20
18
  spec.require_paths = ['lib']
19
+ spec.required_ruby_version = '>= 2.5.0'
21
20
 
22
21
  if defined?(JRUBY_VERSION)
23
22
  spec.platform = 'java'
@@ -37,11 +36,10 @@ Gem::Specification.new do |spec|
37
36
  end
38
37
 
39
38
  spec.add_development_dependency 'allocation_stats', '~> 0.1'
40
- spec.add_development_dependency 'appraisal', '~> 2.4'
41
39
  spec.add_development_dependency 'bundler', '~> 2.2'
42
40
  spec.add_development_dependency 'pry', '~> 0.14'
43
41
  spec.add_development_dependency 'pry-nav', '~> 1.0'
44
- spec.add_development_dependency 'rake', '~> 12.3'
42
+ spec.add_development_dependency 'rake', '~> 13.0'
45
43
  spec.add_development_dependency 'rake-compiler', '~> 1.1'
46
44
  spec.add_development_dependency 'rspec', '~> 3.10'
47
45
  spec.add_development_dependency 'rubocop', '0.59.0'
@@ -49,10 +47,11 @@ Gem::Specification.new do |spec|
49
47
  spec.add_development_dependency 'simplecov-json', '~> 0.2'
50
48
  spec.add_development_dependency 'timecop', '~> 0.9'
51
49
  spec.add_development_dependency 'webmock', '~> 3.14'
50
+ spec.add_development_dependency 'webrick', '~> 1.7'
52
51
 
53
52
  spec.add_runtime_dependency 'bitarray', '~> 1.3'
54
53
  spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
55
- spec.add_runtime_dependency 'faraday', '>= 0.8', '< 2.0'
54
+ spec.add_runtime_dependency 'faraday', '>= 1.1', '< 2.0'
56
55
  spec.add_runtime_dependency 'json', '>= 1.8', '< 3.0'
57
56
  spec.add_runtime_dependency 'jwt', '>= 1.0.0', '< 3.0'
58
57
  spec.add_runtime_dependency 'lru_redux', '~> 1.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.5.pre.rc3
4
+ version: 8.0.0.pre.rc1
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-12 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.1'
27
- - !ruby/object:Gem::Dependency
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '2.4'
33
- name: appraisal
34
- prerelease: false
35
- type: :development
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.4'
41
27
  - !ruby/object:Gem::Dependency
42
28
  requirement: !ruby/object:Gem::Requirement
43
29
  requirements:
@@ -85,7 +71,7 @@ dependencies:
85
71
  requirements:
86
72
  - - "~>"
87
73
  - !ruby/object:Gem::Version
88
- version: '12.3'
74
+ version: '13.0'
89
75
  name: rake
90
76
  prerelease: false
91
77
  type: :development
@@ -93,7 +79,7 @@ dependencies:
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '12.3'
82
+ version: '13.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  requirement: !ruby/object:Gem::Requirement
99
85
  requirements:
@@ -192,6 +178,20 @@ dependencies:
192
178
  - - "~>"
193
179
  - !ruby/object:Gem::Version
194
180
  version: '3.14'
181
+ - !ruby/object:Gem::Dependency
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '1.7'
187
+ name: webrick
188
+ prerelease: false
189
+ type: :development
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.7'
195
195
  - !ruby/object:Gem::Dependency
196
196
  requirement: !ruby/object:Gem::Requirement
197
197
  requirements:
@@ -225,7 +225,7 @@ dependencies:
225
225
  requirements:
226
226
  - - ">="
227
227
  - !ruby/object:Gem::Version
228
- version: '0.8'
228
+ version: '1.1'
229
229
  - - "<"
230
230
  - !ruby/object:Gem::Version
231
231
  version: '2.0'
@@ -236,7 +236,7 @@ dependencies:
236
236
  requirements:
237
237
  - - ">="
238
238
  - !ruby/object:Gem::Version
239
- version: '0.8'
239
+ version: '1.1'
240
240
  - - "<"
241
241
  - !ruby/object:Gem::Version
242
242
  version: '2.0'
@@ -370,7 +370,7 @@ dependencies:
370
370
  version: '0.3'
371
371
  description: Ruby client for using split SDK.
372
372
  email:
373
- - pato@split.io
373
+ - mauro.sanz@split.io
374
374
  executables: []
375
375
  extensions: []
376
376
  extra_rdoc_files: []
@@ -381,7 +381,6 @@ files:
381
381
  - ".gitignore"
382
382
  - ".rubocop.yml"
383
383
  - ".simplecov"
384
- - Appraisals
385
384
  - CHANGES.txt
386
385
  - CONTRIBUTORS-GUIDE.md
387
386
  - Gemfile
@@ -432,7 +431,6 @@ files:
432
431
  - lib/splitclient-rb/constants.rb
433
432
  - lib/splitclient-rb/engine/api/client.rb
434
433
  - lib/splitclient-rb/engine/api/events.rb
435
- - lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb
436
434
  - lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb
437
435
  - lib/splitclient-rb/engine/api/impressions.rb
438
436
  - lib/splitclient-rb/engine/api/segments.rb
@@ -535,7 +533,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
535
533
  requirements:
536
534
  - - ">="
537
535
  - !ruby/object:Gem::Version
538
- version: '0'
536
+ version: 2.5.0
539
537
  required_rubygems_version: !ruby/object:Gem::Requirement
540
538
  requirements:
541
539
  - - ">"
data/Appraisals DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise 'faraday-before-0.13' do
4
- gem 'faraday', '>= 0.9', '< 0.13'
5
- gem 'net-http-persistent', '~> 3.0'
6
- end
7
-
8
- appraise 'faraday-after-0.13' do
9
- gem 'faraday', '> 0.13'
10
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SplitIoClient
4
- module FaradayAdapter
5
- class PatchedNetHttpPersistent < Faraday::Adapter::NetHttpPersistent
6
- ##
7
- # Borrowed directly from the latest `NetHttpPersistent` adapter implementation.
8
- #
9
- # https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http_persistent.rb
10
- #
11
- def net_http_connection(env)
12
- @cached_connection ||=
13
- if Net::HTTP::Persistent.instance_method(:initialize).parameters.first == [:key, :name]
14
- Net::HTTP::Persistent.new(name: 'Faraday')
15
- else
16
- Net::HTTP::Persistent.new('Faraday')
17
- end
18
-
19
- proxy_uri = proxy_uri(env)
20
- @cached_connection.proxy = proxy_uri if @cached_connection.proxy_uri != proxy_uri
21
- @cached_connection
22
- end
23
-
24
- def proxy_uri(env)
25
- proxy_uri = nil
26
- if (proxy = env[:request][:proxy])
27
- proxy_uri = ::URI::HTTP === proxy[:uri] ? proxy[:uri].dup : ::URI.parse(proxy[:uri].to_s)
28
- proxy_uri.user = proxy_uri.password = nil
29
- # awful patch for net-http-persistent 2.8 not unescaping user/password
30
- (
31
- class << proxy_uri;
32
- self;
33
- end).class_eval do
34
- define_method(:user) { proxy[:user] }
35
- define_method(:password) { proxy[:password] }
36
- end if proxy[:user]
37
- end
38
- proxy_uri
39
- end
40
-
41
- def with_net_http_connection(env)
42
- yield net_http_connection(env)
43
- end
44
- end
45
- end
46
- end