excon 0.97.2 → 0.98.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/excon/constants.rb +2 -0
- data/lib/excon/ssl_socket.rb +16 -0
- data/lib/excon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b980a243ce1d748881c7d985f42db2e6fc20b382597220d2c5d5541e8b3359f9
|
4
|
+
data.tar.gz: 2dacdc182c779be0cf4c978092baca5fef6e4fa0971369be2764b7e090830f68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9495b2cf646c81eb2ab6691cbafe44ddc4842cba32abd2c849b348ad13ad0d067f8ef14babeed0cee3116bf7d7939ec68fdc5c7632455104183ea7d1dcefb938
|
7
|
+
data.tar.gz: bdc12e6fc203c223bad18faaa42311ed416befffe2475c74e2d164fca3a44389b55627b3178022a38b6440a54fadba1ec63b8eb42af843f28fdb731713035725
|
data/README.md
CHANGED
@@ -446,7 +446,16 @@ connection = Excon.new('https://example.com',
|
|
446
446
|
|
447
447
|
`client_key_pass` is optional.
|
448
448
|
|
449
|
-
|
449
|
+
Optionally, you can also pass the whole chain by passing the extra certificates through `client_chain`:
|
450
|
+
|
451
|
+
```ruby
|
452
|
+
connection = Excon.new('https://example.com',
|
453
|
+
client_cert: 'mycert.pem',
|
454
|
+
client_chain: 'mychain.pem',
|
455
|
+
client_key: 'mycert.key')
|
456
|
+
```
|
457
|
+
|
458
|
+
If you already have loaded the certificate, key and chain into memory, then pass it through like:
|
450
459
|
|
451
460
|
```ruby
|
452
461
|
client_cert_data = File.load 'mycert.pem'
|
@@ -454,6 +463,7 @@ client_key_data = File.load 'mycert.key'
|
|
454
463
|
|
455
464
|
connection = Excon.new('https://example.com',
|
456
465
|
client_cert_data: client_cert_data,
|
466
|
+
client_chain_data: client_chain_data,
|
457
467
|
client_key_data: client_key_data)
|
458
468
|
```
|
459
469
|
|
data/lib/excon/constants.rb
CHANGED
data/lib/excon/ssl_socket.rb
CHANGED
@@ -90,6 +90,14 @@ module Excon
|
|
90
90
|
else
|
91
91
|
ssl_context.key = OpenSSL::PKey::RSA.new(client_key_data, client_key_pass)
|
92
92
|
end
|
93
|
+
if client_chain_data && OpenSSL::X509::Certificate.respond_to?(:load)
|
94
|
+
ssl_context.extra_chain_cert = OpenSSL::X509::Certificate.load(client_chain_data)
|
95
|
+
elsif client_chain_data
|
96
|
+
certs = client_chain_data.scan(/-----BEGIN CERTIFICATE-----(?:.|\n)+?-----END CERTIFICATE-----/)
|
97
|
+
ssl_context.extra_chain_cert = certs.map do |cert|
|
98
|
+
OpenSSL::X509::Certificate.new(cert)
|
99
|
+
end
|
100
|
+
end
|
93
101
|
elsif @data.key?(:certificate) && @data.key?(:private_key)
|
94
102
|
ssl_context.cert = OpenSSL::X509::Certificate.new(@data[:certificate])
|
95
103
|
if OpenSSL::PKey.respond_to? :read
|
@@ -171,6 +179,14 @@ module Excon
|
|
171
179
|
end
|
172
180
|
end
|
173
181
|
|
182
|
+
def client_chain_data
|
183
|
+
@client_chain_data ||= if (ccd = @data[:client_chain_data])
|
184
|
+
ccd
|
185
|
+
elsif (path = @data[:client_chain])
|
186
|
+
File.read path
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
174
190
|
def connect
|
175
191
|
# backwards compatability for things lacking nonblock
|
176
192
|
@nonblock = HAVE_NONBLOCK && @nonblock
|
data/lib/excon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.98.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dpiddy (Dan Peterson)
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-01-
|
13
|
+
date: 2023-01-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|