net-http-persistent 3.0.0 → 3.0.1

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
- SHA1:
3
- metadata.gz: 2ac4ced8426e3492194191bc08b33f911d09191a
4
- data.tar.gz: a6b022f6d8a64047938b72a3e8bed913b435f547
2
+ SHA256:
3
+ metadata.gz: 544b6c4e52caee7104e021181a7ab8723a625e239820297b7e6d87934c7e0e0e
4
+ data.tar.gz: 03e9df91b7e30d25886c30a650f9e6feb8fa7d945cf5e61b19d416bfe46eff6a
5
5
  SHA512:
6
- metadata.gz: 10729b7555b94f553ee0aed2c51d8ac950f92dc7e669dc39638e6ee76ac64914e8fb54cab8c97cb1087a7f224d8f5ea62d404a81f2d4da00446d1c13c4458533
7
- data.tar.gz: fd5bf2624f9cb961e1086480c9085a4ae14fdc9ae28797b95dd8493887ec0d87e0014e64bb5c52cf16eae4eef5e8aec3b23c745c8698d841163385ae6b9b447f
6
+ metadata.gz: 38b3695f98f1bae796fb0b51b12d992b621ac9d0d8b6e9f885c9327a91d994acdfa18e37018bf5a7a28bf52e11413194b027dd332d3605f913c66f847402d683
7
+ data.tar.gz: 32420e4a50e91fcac562ab34b1c383a7ce529d0c6646a802e4625f5f61b4c017ef6640d4e466bd803d4a5d0172d577cd05ef1979a450ef326af68a76de4f709a
@@ -32,7 +32,7 @@ connection is kept alive between requests:
32
32
 
33
33
  uri = URI 'http://example.com/awesome/web/service'
34
34
 
35
- http = Net::HTTP::Persistent.new 'my_app_name'
35
+ http = Net::HTTP::Persistent.new name: 'my_app_name'
36
36
 
37
37
  # perform a GET
38
38
  response = http.request uri
@@ -33,7 +33,7 @@ autoload :OpenSSL, 'openssl'
33
33
  #
34
34
  # uri = URI 'http://example.com/awesome/web/service'
35
35
  #
36
- # http = Net::HTTP::Persistent.new 'my_app_name'
36
+ # http = Net::HTTP::Persistent.new name: 'my_app_name'
37
37
  #
38
38
  # # perform a GET
39
39
  # response = http.request uri
@@ -153,7 +153,7 @@ autoload :OpenSSL, 'openssl'
153
153
  # uri = URI 'http://example.com/awesome/web/service'
154
154
  # post_uri = uri + 'create'
155
155
  #
156
- # http = Net::HTTP::Persistent.new 'my_app_name'
156
+ # http = Net::HTTP::Persistent.new name: 'my_app_name'
157
157
  #
158
158
  # post = Net::HTTP::Post.new post_uri.path
159
159
  # # ... fill in POST request
@@ -207,7 +207,7 @@ class Net::HTTP::Persistent
207
207
  ##
208
208
  # The version of Net::HTTP::Persistent you are using
209
209
 
210
- VERSION = '3.0.0'
210
+ VERSION = '3.0.1'
211
211
 
212
212
  ##
213
213
  # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
@@ -440,10 +440,26 @@ class Net::HTTP::Persistent
440
440
  # SSL version to use.
441
441
  #
442
442
  # By default, the version will be negotiated automatically between client
443
- # and server. Ruby 1.9 and newer only.
443
+ # and server. Ruby 1.9 and newer only. Deprecated since Ruby 2.5.
444
444
 
445
445
  attr_reader :ssl_version
446
446
 
447
+ ##
448
+ # Minimum SSL version to use, e.g. :TLS1_1
449
+ #
450
+ # By default, the version will be negotiated automatically between client
451
+ # and server. Ruby 2.5 and newer only.
452
+
453
+ attr_reader :min_version
454
+
455
+ ##
456
+ # Maximum SSL version to use, e.g. :TLS1_2
457
+ #
458
+ # By default, the version will be negotiated automatically between client
459
+ # and server. Ruby 2.5 and newer only.
460
+
461
+ attr_reader :max_version
462
+
447
463
  ##
448
464
  # Where this instance's last-use times live in the thread local variables
449
465
 
@@ -533,6 +549,8 @@ class Net::HTTP::Persistent
533
549
  @private_key = nil
534
550
  @ssl_timeout = nil
535
551
  @ssl_version = nil
552
+ @min_version = nil
553
+ @max_version = nil
536
554
  @verify_callback = nil
537
555
  @verify_depth = nil
538
556
  @verify_mode = nil
@@ -744,7 +762,7 @@ class Net::HTTP::Persistent
744
762
 
745
763
  ##
746
764
  # Pipelines +requests+ to the HTTP server at +uri+ yielding responses if a
747
- # block is given. Returns all responses recieved.
765
+ # block is given. Returns all responses received.
748
766
  #
749
767
  # See
750
768
  # Net::HTTP::Pipeline[http://docs.seattlerb.org/net-http-pipeline/Net/HTTP/Pipeline.html]
@@ -1030,9 +1048,7 @@ class Net::HTTP::Persistent
1030
1048
  # #shutdown when you are completely done making requests!
1031
1049
 
1032
1050
  def shutdown
1033
- @pool.available.shutdown do |http|
1034
- http.finish
1035
- end
1051
+ @pool.shutdown { |http| http.finish }
1036
1052
  end
1037
1053
 
1038
1054
  ##
@@ -1044,6 +1060,8 @@ class Net::HTTP::Persistent
1044
1060
  connection.ciphers = @ciphers if @ciphers
1045
1061
  connection.ssl_timeout = @ssl_timeout if @ssl_timeout
1046
1062
  connection.ssl_version = @ssl_version if @ssl_version
1063
+ connection.min_version = @min_version if @min_version
1064
+ connection.max_version = @max_version if @max_version
1047
1065
 
1048
1066
  connection.verify_depth = @verify_depth
1049
1067
  connection.verify_mode = @verify_mode
@@ -1115,6 +1133,24 @@ application:
1115
1133
  reconnect_ssl
1116
1134
  end
1117
1135
 
1136
+ ##
1137
+ # Minimum SSL version to use
1138
+
1139
+ def min_version= min_version
1140
+ @min_version = min_version
1141
+
1142
+ reconnect_ssl
1143
+ end
1144
+
1145
+ ##
1146
+ # maximum SSL version to use
1147
+
1148
+ def max_version= max_version
1149
+ @max_version = max_version
1150
+
1151
+ reconnect_ssl
1152
+ end
1153
+
1118
1154
  ##
1119
1155
  # Sets the depth of SSL certificate verification
1120
1156
 
@@ -7,11 +7,11 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
7
7
  super
8
8
 
9
9
  @available = Net::HTTP::Persistent::TimedStackMulti.new(@size, &block)
10
- @key = :"current-#{@available.object_id}"
10
+ @key = "current-#{@available.object_id}"
11
11
  end
12
12
 
13
13
  def checkin net_http_args
14
- stack = Thread.current[@key][net_http_args]
14
+ stack = Thread.current[@key][net_http_args] ||= []
15
15
 
16
16
  raise ConnectionPool::Error, 'no connections are checked out' if
17
17
  stack.empty?
@@ -26,8 +26,8 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
26
26
  end
27
27
 
28
28
  def checkout net_http_args
29
- stacks = Thread.current[@key] ||= Hash.new { |h, k| h[k] = [] }
30
- stack = stacks[net_http_args]
29
+ stacks = Thread.current[@key] ||= {}
30
+ stack = stacks[net_http_args] ||= []
31
31
 
32
32
  if stack.empty? then
33
33
  conn = @available.pop connection_args: net_http_args
@@ -40,6 +40,10 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
40
40
  conn
41
41
  end
42
42
 
43
+ def shutdown
44
+ Thread.current[@key] = nil
45
+ super
46
+ end
43
47
  end
44
48
 
45
49
  require 'net/http/persistent/timed_stack_multi'
@@ -77,8 +77,8 @@ class TestNetHttpPersistent < Minitest::Test
77
77
  class BasicConnection
78
78
  attr_accessor :started, :finished, :address, :port, :use_ssl,
79
79
  :read_timeout, :open_timeout, :keep_alive_timeout
80
- attr_accessor :ciphers, :ssl_timeout, :ssl_version,
81
- :verify_depth, :verify_mode, :cert_store,
80
+ attr_accessor :ciphers, :ssl_timeout, :ssl_version, :min_version,
81
+ :max_version, :verify_depth, :verify_mode, :cert_store,
82
82
  :ca_file, :ca_path, :cert, :key
83
83
  attr_reader :req, :debug_output
84
84
  def initialize
@@ -786,7 +786,7 @@ class TestNetHttpPersistent < Minitest::Test
786
786
  def test_proxy_equals_nil
787
787
  @http.proxy = nil
788
788
 
789
- assert_equal nil, @http.proxy_uri
789
+ assert_nil @http.proxy_uri
790
790
 
791
791
  assert_equal 1, @http.generation, 'generation'
792
792
  assert_equal 1, @http.ssl_generation, 'ssl_generation'
@@ -1094,7 +1094,7 @@ class TestNetHttpPersistent < Minitest::Test
1094
1094
  assert_kind_of Net::HTTP::Get, req
1095
1095
  assert_equal '/path', req.path
1096
1096
  assert_equal 'close', req['connection']
1097
- assert_equal nil, req['keep-alive']
1097
+ assert_nil req['keep-alive']
1098
1098
 
1099
1099
  assert c.http.finished?
1100
1100
  end
@@ -1527,6 +1527,20 @@ class TestNetHttpPersistent < Minitest::Test
1527
1527
  assert_equal 1, @http.ssl_generation
1528
1528
  end
1529
1529
 
1530
+ def test_min_version_equals
1531
+ @http.min_version = :min_version
1532
+
1533
+ assert_equal :min_version, @http.min_version
1534
+ assert_equal 1, @http.ssl_generation
1535
+ end
1536
+
1537
+ def test_max_version_equals
1538
+ @http.max_version = :max_version
1539
+
1540
+ assert_equal :max_version, @http.max_version
1541
+ assert_equal 1, @http.ssl_generation
1542
+ end
1543
+
1530
1544
  def test_start
1531
1545
  c = basic_connection
1532
1546
  c = c.http
metadata CHANGED
@@ -1,35 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-http-persistent
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDNjCCAh6gAwIBAgIBBDANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
14
- YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
15
- ZXQwHhcNMTYxMDA1MDQyNTQ0WhcNMTcxMDA1MDQyNTQ0WjBBMRAwDgYDVQQDDAdk
16
- cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
17
- FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
18
- LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
19
- U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
20
- Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
21
- mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
22
- g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
23
- sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
- BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQUFAAOCAQEAFz46xasn
25
- 5Jx0lPqq6EGpijLIWv+jk+m2v3Ps38M2ZmNpiThmYFBHIqfDCS0UJWDPTj6FJX0A
26
- rspSuifsHq3CQ3RJImdO9Gewvx6p3WL/xZD1LmuRo6ktWH9gZWiZpA38GfFGj3SZ
27
- 2u6n3qOEsaxIfwYcU4lCgeZ61JdVU+WWK+GfZpCz4BnjA5hgwdFaf5Zb560RtW7S
28
- 77pi/SZtblyK/jqz1hgoMcaYZvIJTqZnen0pHaq+lKY1KzGdTuVbwD3DO+Fi1Vu8
29
- BOJAX2VNKk4wthxdCu0SvPe7e+QMP2rmaZOyuX4ztiDQiGuoJxyeqoG1WiOttINU
30
- U76tHMFuL0FUYw==
31
- -----END CERTIFICATE-----
32
- date: 2016-10-06 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2019-04-29 00:00:00.000000000 Z
33
12
  dependencies:
34
13
  - !ruby/object:Gem::Dependency
35
14
  name: connection_pool
@@ -51,42 +30,48 @@ dependencies:
51
30
  requirements:
52
31
  - - "~>"
53
32
  - !ruby/object:Gem::Version
54
- version: '5.8'
33
+ version: '5.11'
55
34
  type: :development
56
35
  prerelease: false
57
36
  version_requirements: !ruby/object:Gem::Requirement
58
37
  requirements:
59
38
  - - "~>"
60
39
  - !ruby/object:Gem::Version
61
- version: '5.8'
40
+ version: '5.11'
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: rdoc
64
43
  requirement: !ruby/object:Gem::Requirement
65
44
  requirements:
66
- - - "~>"
45
+ - - ">="
67
46
  - !ruby/object:Gem::Version
68
47
  version: '4.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '7'
69
51
  type: :development
70
52
  prerelease: false
71
53
  version_requirements: !ruby/object:Gem::Requirement
72
54
  requirements:
73
- - - "~>"
55
+ - - ">="
74
56
  - !ruby/object:Gem::Version
75
57
  version: '4.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '7'
76
61
  - !ruby/object:Gem::Dependency
77
62
  name: hoe
78
63
  requirement: !ruby/object:Gem::Requirement
79
64
  requirements:
80
65
  - - "~>"
81
66
  - !ruby/object:Gem::Version
82
- version: '3.15'
67
+ version: '3.17'
83
68
  type: :development
84
69
  prerelease: false
85
70
  version_requirements: !ruby/object:Gem::Requirement
86
71
  requirements:
87
72
  - - "~>"
88
73
  - !ruby/object:Gem::Version
89
- version: '3.15'
74
+ version: '3.17'
90
75
  description: |-
91
76
  Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8.
92
77
  It's thread-safe too!
@@ -141,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
126
  - !ruby/object:Gem::Version
142
127
  version: '0'
143
128
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.6.4
129
+ rubygems_version: 3.0.1
146
130
  signing_key:
147
131
  specification_version: 4
148
132
  summary: Manages persistent connections using Net::HTTP plus a speed fix for Ruby
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- �纯t�O��6�ճ���