ezclient 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6907661025b4a4e23d639bc2672bae03b767c7801f831ba1a858648aed14ba2
4
- data.tar.gz: 4557f0603ba11f86f01fba2fcda3d830c2bb45fbbf2f9d2a2a0e4387fe05820b
3
+ metadata.gz: f95857956414f9377de79dd8b0b29bc54de9dcb57ef0cdcff1e2964f14030d3f
4
+ data.tar.gz: 0e37a6cda106514431b61640582e89b97434c59bd8e281549a1e1de528e18ab3
5
5
  SHA512:
6
- metadata.gz: e2f0c198622924ebe163d487093f254c93b6f297635ee430c587928f5261cf6477b93f91921fda5d4175433da7c16e853ec75d47ddff660a3f6bd5d1c6ce0666
7
- data.tar.gz: 77a73530da0957847959eb5283ca725a1f1afd80954629ac803e2c92b8a31663041815e05cc81ce21a0a7d2427db0f0522bdcbf71f264608706da3a28c16164d
6
+ metadata.gz: d3541368eac52018a2ef482e41d13fc785466da7be953d4a6a9f44ea86ce66a0498d844f8ff86cd5b6048fbb334ad508249273ad0fa8f91fadf3cca0e9430609
7
+ data.tar.gz: ada38c6791768ceb5a3f01877b0236b9400392b32dc4f32d0b9a4c6299bd685f13c38499c49b3e23c63f9461c4e18e3b9829242ce5a804043d06be9b6bc19194
data/.rubocop.yml CHANGED
@@ -16,6 +16,7 @@ AllCops:
16
16
  - gemfile/**/*
17
17
  Exclude:
18
18
  - vendor/**/*
19
+ - spec/files/**/*
19
20
 
20
21
  RSpec/SpecFilePathFormat:
21
22
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ezclient (1.7.1)
4
+ ezclient (1.7.2)
5
5
  http (>= 4)
6
6
 
7
7
  GEM
@@ -28,9 +28,12 @@ class EzClient::Client
28
28
 
29
29
  keep_alive_timeout = options.delete(:keep_alive)
30
30
  api_auth = options.delete(:api_auth)
31
+ ssl_context = options[:ssl_context]
31
32
 
32
33
  if keep_alive_timeout
33
- client = persistent_client_registry.for(url, timeout: keep_alive_timeout)
34
+ client = persistent_client_registry.for(
35
+ url, ssl_context: ssl_context, timeout: keep_alive_timeout
36
+ )
34
37
  else
35
38
  client = HTTP::Client.new
36
39
  end
@@ -5,17 +5,31 @@ class EzClient::PersistentClientRegistry
5
5
  self.registry = {}
6
6
  end
7
7
 
8
- def for(url, timeout:)
8
+ def for(url, ssl_context:, timeout:)
9
9
  cleanup_registry!
10
- uri = HTTP::URI.parse(url)
11
- registry[uri.origin] ||= EzClient::PersistentClient.new(uri.origin, timeout)
10
+
11
+ origin = get_origin(url)
12
+ registry[origin] ||= {}
13
+
14
+ ssl_bucket = ssl_context&.cert ? get_cert_sha256(ssl_context.cert) : nil
15
+ registry[origin][ssl_bucket] ||= EzClient::PersistentClient.new(origin, timeout)
12
16
  end
13
17
 
14
18
  private
15
19
 
16
20
  attr_accessor :registry
17
21
 
22
+ def get_cert_sha256(cert)
23
+ Digest::SHA256.hexdigest(cert.to_der)
24
+ end
25
+
26
+ def get_origin(url)
27
+ HTTP::URI.parse(url).origin
28
+ end
29
+
18
30
  def cleanup_registry!
19
- registry.delete_if { |_origin, client| client.timed_out? }
31
+ registry.each_value do |ssl_buckets|
32
+ ssl_buckets.delete_if { |_ssl_bucket, client| client.timed_out? }
33
+ end
20
34
  end
21
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzClient
4
- VERSION = "1.7.1"
4
+ VERSION = "1.7.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Smirnov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: http
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '4'
27
- description:
28
26
  email:
29
27
  - tycooon@yandex.ru
30
28
  - oss@umbrellio.biz
@@ -57,7 +55,6 @@ homepage: https://github.com/umbrellio/ezclient
57
55
  licenses:
58
56
  - MIT
59
57
  metadata: {}
60
- post_install_message:
61
58
  rdoc_options: []
62
59
  require_paths:
63
60
  - lib
@@ -72,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
69
  - !ruby/object:Gem::Version
73
70
  version: '0'
74
71
  requirements: []
75
- rubygems_version: 3.5.18
76
- signing_key:
72
+ rubygems_version: 3.6.7
77
73
  specification_version: 4
78
74
  summary: An HTTP gem wrapper for easy persistent connections and more.
79
75
  test_files: []