net-http-persistent 4.0.4 → 4.0.5

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: d990a23527093f31794ae1e926c425666b2d680ed811282dd4b795a24862876a
4
- data.tar.gz: a4faf258fd1a299cd1c86a45a68f6d7034105633313255a16485f9a1f6015507
3
+ metadata.gz: 182064ce89718e66d95177021a7005adeb6e1d4299925e90fc6ac2a537dc533d
4
+ data.tar.gz: ef7588300c587a1f71e49496ed6131acdf3cad110fa6653acab3779f5f01e3ee
5
5
  SHA512:
6
- metadata.gz: bb00624ad04bf5380843d1870b3cd23b6f2a6442c2f956869dbac748dcdfe65fb6f040139c1e859d2b0df0592ef45119ad9701f2b9e8a983f741b3ecb05c6087
7
- data.tar.gz: addb4fbf6cf6c051406ca5d03243d8cf5b5ba605b7cac229b0ca6df1dc61f030222d22d5e8380deaf45df6489a4ec9dd1b83309197be893df266b86fa9b0eaf8
6
+ metadata.gz: 14c95c55ea8c89616d13917ba1fb9b05253181fd7007cf5aa03ab03c8e9987e8d4dc936b21481bf37f810df5931994ea6e5dc2eb6c259ab6591f2cfa75bff24f
7
+ data.tar.gz: e7560d360ac6b20b750a19f6b84c7e5f8656e44962fbb8223ae1295e18dea513456df99c268fa06c2909b9c7e1c4e96655b7055432032d1044187ce07a2ba40b
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 4.0.5 / 2024-12-04
2
+
3
+ Bug fixes:
4
+
5
+ * Allow setting extra_chain_cert=
6
+
1
7
  === 4.0.4 / 2024-09-09
2
8
 
3
9
  Bug fixes:
@@ -65,6 +65,7 @@ autoload :OpenSSL, 'openssl'
65
65
  # #ca_path :: Directory with certificate-authorities
66
66
  # #cert_store :: An SSL certificate store
67
67
  # #ciphers :: List of SSl ciphers allowed
68
+ # #extra_chain_cert :: Extra certificates to be added to the certificate chain
68
69
  # #private_key :: The client's SSL private key
69
70
  # #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
70
71
  # connection
@@ -181,7 +182,7 @@ class Net::HTTP::Persistent
181
182
  ##
182
183
  # The version of Net::HTTP::Persistent you are using
183
184
 
184
- VERSION = '4.0.4'
185
+ VERSION = '4.0.5'
185
186
 
186
187
  ##
187
188
  # Error class for errors raised by Net::HTTP::Persistent. Various
@@ -272,6 +273,11 @@ class Net::HTTP::Persistent
272
273
 
273
274
  attr_reader :ciphers
274
275
 
276
+ ##
277
+ # Extra certificates to be added to the certificate chain
278
+
279
+ attr_reader :extra_chain_cert
280
+
275
281
  ##
276
282
  # Sends debug_output to this IO via Net::HTTP#set_debug_output.
277
283
  #
@@ -592,6 +598,21 @@ class Net::HTTP::Persistent
592
598
  reconnect_ssl
593
599
  end
594
600
 
601
+ if Net::HTTP.method_defined?(:extra_chain_cert=)
602
+ ##
603
+ # Extra certificates to be added to the certificate chain.
604
+ # It is only supported starting from Net::HTTP version 0.1.1
605
+ def extra_chain_cert= extra_chain_cert
606
+ @extra_chain_cert = extra_chain_cert
607
+
608
+ reconnect_ssl
609
+ end
610
+ else
611
+ def extra_chain_cert= _extra_chain_cert
612
+ raise "extra_chain_cert= is not supported by this version of Net::HTTP"
613
+ end
614
+ end
615
+
595
616
  ##
596
617
  # Creates a new connection for +uri+
597
618
 
@@ -1043,6 +1064,10 @@ application:
1043
1064
  connection.key = @private_key
1044
1065
  end
1045
1066
 
1067
+ if defined?(@extra_chain_cert) and @extra_chain_cert
1068
+ connection.extra_chain_cert = @extra_chain_cert
1069
+ end
1070
+
1046
1071
  connection.cert_store = if @cert_store then
1047
1072
  @cert_store
1048
1073
  else
@@ -247,6 +247,14 @@ class TestNetHttpPersistent < Minitest::Test
247
247
  assert_equal 1, @http.ssl_generation
248
248
  end
249
249
 
250
+ def test_extra_chain_cert_equals
251
+ skip 'extra_chain_cert is not supported by Net::HTTP' unless Net::HTTP.method_defined?(:extra_chain_cert)
252
+ @http.extra_chain_cert = :extra_chain_cert
253
+
254
+ assert_equal :extra_chain_cert, @http.extra_chain_cert
255
+ assert_equal 1, @http.ssl_generation
256
+ end
257
+
250
258
  def test_connection_for
251
259
  @http.open_timeout = 123
252
260
  @http.read_timeout = 321
@@ -1373,6 +1381,18 @@ class TestNetHttpPersistent < Minitest::Test
1373
1381
  assert c.verify_hostname == false
1374
1382
  end
1375
1383
 
1384
+ def test_ssl_extra_chain_cert
1385
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1386
+ skip 'extra_chain_cert is not supported by Net::HTTP' unless Net::HTTP.method_defined?(:extra_chain_cert)
1387
+
1388
+ @http.extra_chain_cert = :extra_chain_cert
1389
+ c = Net::HTTP.new 'localhost', 80
1390
+
1391
+ @http.ssl c
1392
+
1393
+ assert c.use_ssl?
1394
+ assert_equal :extra_chain_cert, c.extra_chain_cert
1395
+ end
1376
1396
 
1377
1397
  def test_ssl_warning
1378
1398
  skip 'OpenSSL is missing' unless HAVE_OPENSSL
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-http-persistent
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-09 00:00:00.000000000 Z
11
+ date: 2024-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool