excon 0.97.1 → 0.98.0

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
  SHA256:
3
- metadata.gz: ee0b45af4f7467933687432b2eca89846435cf7fe55b76e17e437b81754fa5cb
4
- data.tar.gz: fb52600cfbdaa2ef778ce9131e1905135f80bf74b39db16ca04b67ba379966e3
3
+ metadata.gz: b980a243ce1d748881c7d985f42db2e6fc20b382597220d2c5d5541e8b3359f9
4
+ data.tar.gz: 2dacdc182c779be0cf4c978092baca5fef6e4fa0971369be2764b7e090830f68
5
5
  SHA512:
6
- metadata.gz: 010da7bd227bce02def5a8041d20df6d5f7a4f02a19a04cf4cec60d095f3123bec397476bb7f8c1c55ba56c0ddd969d39d1bde9c2b88749fa3dde17a94f67448
7
- data.tar.gz: '0419fa670f965885905f35f8bf95c5a8f8db8c76b172a77ae6c53ff344345c2957a0703454e3080fb2e0e24a8224cf865437334ae956ede7945d7e99e55853d7'
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,
@@ -81,12 +81,13 @@ module Excon
81
81
  :body => String.new,
82
82
  :cookies => [],
83
83
  :host => datum[:host],
84
- :scheme => datum[:scheme],
85
- :method => datum[:method],
84
+ :scheme => datum[:scheme],
85
+ :method => datum[:method],
86
86
  :headers => Excon::Headers.new,
87
87
  :path => datum[:path],
88
- :query => datum[:query],
88
+ :query => datum[:query],
89
89
  :port => datum[:port],
90
+ :omit_default_port => datum[:omit_default_port],
90
91
  :status => status,
91
92
  :status_line => line,
92
93
  :reason_phrase => reason_phrase
@@ -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.1'
3
+ VERSION = '0.98.0'
4
4
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.97.1
4
+ version: 0.98.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
8
8
  - geemus (Wesley Beary)
9
9
  - nextmat (Matt Sanders)
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-01-11 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
@@ -235,7 +235,7 @@ metadata:
235
235
  documentation_uri: https://github.com/excon/excon/blob/master/README.md
236
236
  source_code_uri: https://github.com/excon/excon
237
237
  wiki_uri: https://github.com/excon/excon/wiki
238
- post_install_message:
238
+ post_install_message:
239
239
  rdoc_options:
240
240
  - "--charset=UTF-8"
241
241
  require_paths:
@@ -251,8 +251,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.3.5
255
- signing_key:
254
+ rubygems_version: 3.4.1
255
+ signing_key:
256
256
  specification_version: 4
257
257
  summary: speed, persistence, http(s)
258
258
  test_files: []