excon 0.97.2 → 0.98.0

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: b7299d2595012ebdc3e6ea3a6e7c9478a1f541864d7fc1b1147cd7a315180d66
4
- data.tar.gz: 795a5765db34fb7976fc828c34dc1787fab67f8decefbe1b1175b29ea1ac4fd5
3
+ metadata.gz: b980a243ce1d748881c7d985f42db2e6fc20b382597220d2c5d5541e8b3359f9
4
+ data.tar.gz: 2dacdc182c779be0cf4c978092baca5fef6e4fa0971369be2764b7e090830f68
5
5
  SHA512:
6
- metadata.gz: 38892a1a6bc4a36111a94381ddea0df672887bbe27daa0aae92db51101a59559b30939352a6f992d3ee60f6a85434e2ee3479523e161292c0706debd0b44140c
7
- data.tar.gz: 6f2a03711c7aff7137e65bb01799edc2455b359df86c42b491db42d82090397d74191ee3e72d420656adcd1295b317f7c7a031002f3f6385fd15cf9a0974c7ce
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
- If you already have loaded the certificate and key into memory, then pass it through like:
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
 
@@ -72,6 +72,8 @@ module Excon
72
72
  :client_key_pass,
73
73
  :client_cert,
74
74
  :client_cert_data,
75
+ :client_chain,
76
+ :client_chain_data,
75
77
  :certificate,
76
78
  :certificate_path,
77
79
  :disable_proxy,
@@ -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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Excon
3
- VERSION = '0.97.2'
3
+ VERSION = '0.98.0'
4
4
  end
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.97.2
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-20 00:00:00.000000000 Z
13
+ date: 2023-01-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec