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 +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +1 -1
- data/lib/ezclient/client.rb +4 -1
- data/lib/ezclient/persistent_client_registry.rb +18 -4
- data/lib/ezclient/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f95857956414f9377de79dd8b0b29bc54de9dcb57ef0cdcff1e2964f14030d3f
|
4
|
+
data.tar.gz: 0e37a6cda106514431b61640582e89b97434c59bd8e281549a1e1de528e18ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3541368eac52018a2ef482e41d13fc785466da7be953d4a6a9f44ea86ce66a0498d844f8ff86cd5b6048fbb334ad508249273ad0fa8f91fadf3cca0e9430609
|
7
|
+
data.tar.gz: ada38c6791768ceb5a3f01877b0236b9400392b32dc4f32d0b9a4c6299bd685f13c38499c49b3e23c63f9461c4e18e3b9829242ce5a804043d06be9b6bc19194
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/ezclient/client.rb
CHANGED
@@ -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(
|
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
|
-
|
11
|
-
|
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.
|
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
|
data/lib/ezclient/version.rb
CHANGED
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.
|
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:
|
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.
|
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: []
|