net-http-persistent 4.0.3 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +13 -1
- data/lib/net/http/persistent.rb +28 -4
- data/test/test_net_http_persistent.rb +37 -2
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 182064ce89718e66d95177021a7005adeb6e1d4299925e90fc6ac2a537dc533d
|
4
|
+
data.tar.gz: ef7588300c587a1f71e49496ed6131acdf3cad110fa6653acab3779f5f01e3ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c95c55ea8c89616d13917ba1fb9b05253181fd7007cf5aa03ab03c8e9987e8d4dc936b21481bf37f810df5931994ea6e5dc2eb6c259ab6591f2cfa75bff24f
|
7
|
+
data.tar.gz: e7560d360ac6b20b750a19f6b84c7e5f8656e44962fbb8223ae1295e18dea513456df99c268fa06c2909b9c7e1c4e96655b7055432032d1044187ce07a2ba40b
|
data/History.txt
CHANGED
data/lib/net/http/persistent.rb
CHANGED
@@ -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.
|
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
|
|
@@ -1001,7 +1022,7 @@ class Net::HTTP::Persistent
|
|
1001
1022
|
connection.verify_depth = @verify_depth
|
1002
1023
|
connection.verify_mode = @verify_mode
|
1003
1024
|
connection.verify_hostname = @verify_hostname if
|
1004
|
-
@verify_hostname && connection.respond_to?(:verify_hostname=)
|
1025
|
+
@verify_hostname != nil && connection.respond_to?(:verify_hostname=)
|
1005
1026
|
|
1006
1027
|
if OpenSSL::SSL::VERIFY_PEER == OpenSSL::SSL::VERIFY_NONE and
|
1007
1028
|
not Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then
|
@@ -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
|
@@ -1111,7 +1136,7 @@ application:
|
|
1111
1136
|
end
|
1112
1137
|
|
1113
1138
|
##
|
1114
|
-
# Sets the HTTPS verify_hostname.
|
1139
|
+
# Sets the HTTPS verify_hostname.
|
1115
1140
|
|
1116
1141
|
def verify_hostname= verify_hostname
|
1117
1142
|
@verify_hostname = verify_hostname
|
@@ -1131,4 +1156,3 @@ end
|
|
1131
1156
|
|
1132
1157
|
require_relative 'persistent/connection'
|
1133
1158
|
require_relative 'persistent/pool'
|
1134
|
-
|
@@ -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
|
@@ -1343,7 +1351,7 @@ class TestNetHttpPersistent < Minitest::Test
|
|
1343
1351
|
assert_equal OpenSSL::SSL::VERIFY_NONE, c.verify_mode
|
1344
1352
|
end
|
1345
1353
|
|
1346
|
-
def
|
1354
|
+
def test_ssl_enable_verify_hostname
|
1347
1355
|
skip 'OpenSSL is missing' unless HAVE_OPENSSL
|
1348
1356
|
|
1349
1357
|
@http.verify_hostname = true
|
@@ -1358,6 +1366,34 @@ class TestNetHttpPersistent < Minitest::Test
|
|
1358
1366
|
assert c.verify_hostname
|
1359
1367
|
end
|
1360
1368
|
|
1369
|
+
def test_ssl_disable_verify_hostname
|
1370
|
+
skip 'OpenSSL is missing' unless HAVE_OPENSSL
|
1371
|
+
|
1372
|
+
@http.verify_hostname = false
|
1373
|
+
c = Net::HTTP.new 'localhost', 80
|
1374
|
+
|
1375
|
+
skip 'net/http doesn\'t provide verify_hostname= method' unless
|
1376
|
+
c.respond_to?(:verify_hostname=)
|
1377
|
+
|
1378
|
+
@http.ssl c
|
1379
|
+
|
1380
|
+
assert c.use_ssl?
|
1381
|
+
assert c.verify_hostname == false
|
1382
|
+
end
|
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
|
1396
|
+
|
1361
1397
|
def test_ssl_warning
|
1362
1398
|
skip 'OpenSSL is missing' unless HAVE_OPENSSL
|
1363
1399
|
|
@@ -1474,4 +1510,3 @@ class TestNetHttpPersistent < Minitest::Test
|
|
1474
1510
|
end
|
1475
1511
|
end
|
1476
1512
|
end
|
1477
|
-
|
metadata
CHANGED
@@ -1,13 +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
|
+
version: 4.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Hodel
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date: 2024-
|
11
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: connection_pool
|
@@ -62,6 +63,7 @@ licenses:
|
|
62
63
|
- MIT
|
63
64
|
metadata:
|
64
65
|
homepage_uri: https://github.com/drbrain/net-http-persistent
|
66
|
+
post_install_message:
|
65
67
|
rdoc_options:
|
66
68
|
- "--main"
|
67
69
|
- README.rdoc
|
@@ -78,7 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
80
|
- !ruby/object:Gem::Version
|
79
81
|
version: '0'
|
80
82
|
requirements: []
|
81
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.0.3.1
|
84
|
+
signing_key:
|
82
85
|
specification_version: 4
|
83
86
|
summary: Manages persistent connections using Net::HTTP including a thread pool for
|
84
87
|
connecting to multiple hosts
|