net-http-persistent 4.0.6 → 4.0.7

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: 85a943098d06763f4de093bc75563f2df1bb927471fadf3dd3b2c8bd9df22d36
4
- data.tar.gz: 49b04bd17537e5d4939c987b64ac40e1747ee22fa9d5a98751962810bf279153
3
+ metadata.gz: d13ea72f6eaa649a5afa7d75edc0322ae379aa6b58e96df1c4ce8f968aae4e58
4
+ data.tar.gz: 4a27f74cede0dde8f689d7bf3991bf623ed8126fe58a0cedc3e21ddfd82b3562
5
5
  SHA512:
6
- metadata.gz: ffa114cb93989e4bd4d025b6c3823856efe39d0f06206d6f34605125d780306b7e22fc0c97e9a18737f9fe6d68acc73c23ab125a7f80ee68d90a93aa305dafbc
7
- data.tar.gz: 492748215d7b48f67c6221728fb566297831cfc75715f97cc55dd8ac329b1082a1bac9163657961bb7fa8baef0ff407c74b1ff4a2c8f0286dcfe030109944549
6
+ metadata.gz: cb6f7f934a1a1e0baea5821599d3acde60ae304d7e5bbb8b4052f293e1007fe019b569ba049dffbbce3fdba161cd89e2bcd5d772eabe71097f720013dfef5688
7
+ data.tar.gz: c0b5e958e4f5f3357a3d7d820a9d44c3fc1ee6f4abf58e39d59afa0eebf28cdd0563161dc7994b0bbb1adc03725b863703892be38b34efac6d9c977be944505d
@@ -4,7 +4,7 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
4
4
  attr_reader :key # :nodoc:
5
5
 
6
6
  def initialize(options = {}, &block)
7
- super
7
+ super(**options, &block)
8
8
 
9
9
  @available = Net::HTTP::Persistent::TimedStackMulti.new(@size, &block)
10
10
  @key = "current-#{@available.object_id}"
@@ -1,5 +1,10 @@
1
1
  class Net::HTTP::Persistent::TimedStackMulti < ConnectionPool::TimedStack # :nodoc:
2
2
 
3
+ ##
4
+ # Detects if ConnectionPool 3.0+ is being used (needed for TimedStack subclass compatibility)
5
+
6
+ CP_USES_KEYWORD_ARGS = Gem::Version.new(ConnectionPool::VERSION) >= Gem::Version.new('3.0.0') # :nodoc:
7
+
3
8
  ##
4
9
  # Returns a new hash that has arrays for keys
5
10
  #
@@ -11,7 +16,11 @@ class Net::HTTP::Persistent::TimedStackMulti < ConnectionPool::TimedStack # :nod
11
16
  end
12
17
 
13
18
  def initialize(size = 0, &block)
14
- super
19
+ if CP_USES_KEYWORD_ARGS
20
+ super(size: size, &block)
21
+ else
22
+ super(size, &block)
23
+ end
15
24
 
16
25
  @enqueued = 0
17
26
  @ques = self.class.hash_of_arrays
@@ -181,7 +181,7 @@ class Net::HTTP::Persistent
181
181
  ##
182
182
  # The version of Net::HTTP::Persistent you are using
183
183
 
184
- VERSION = '4.0.6'
184
+ VERSION = '4.0.7'
185
185
 
186
186
  ##
187
187
  # Error class for errors raised by Net::HTTP::Persistent. Various
@@ -476,6 +476,13 @@ class Net::HTTP::Persistent
476
476
 
477
477
  attr_reader :verify_hostname
478
478
 
479
+
480
+ ##
481
+ # Sets whether to ignore end-of-file when reading a response body
482
+ # with Content-Length headers.
483
+
484
+ attr_accessor :ignore_eof
485
+
479
486
  ##
480
487
  # Creates a new Net::HTTP::Persistent.
481
488
  #
@@ -515,6 +522,7 @@ class Net::HTTP::Persistent
515
522
  @max_retries = 1
516
523
  @socket_options = []
517
524
  @ssl_generation = 0 # incremented when SSL session variables change
525
+ @ignore_eof = nil
518
526
 
519
527
  @socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
520
528
  Socket.const_defined? :TCP_NODELAY
@@ -643,6 +651,7 @@ class Net::HTTP::Persistent
643
651
  reset connection
644
652
  end
645
653
 
654
+ http.ignore_eof = @ignore_eof if @ignore_eof
646
655
  http.keep_alive_timeout = @idle_timeout if @idle_timeout
647
656
  http.max_retries = @max_retries if http.respond_to?(:max_retries=)
648
657
  http.read_timeout = @read_timeout if @read_timeout
@@ -80,7 +80,7 @@ class TestNetHttpPersistent < Minitest::Test
80
80
  :read_timeout, :open_timeout, :keep_alive_timeout
81
81
  attr_accessor :ciphers, :ssl_timeout, :ssl_version, :min_version,
82
82
  :max_version, :verify_depth, :verify_mode, :cert_store,
83
- :ca_file, :ca_path, :cert, :key
83
+ :ca_file, :ca_path, :cert, :key, :ignore_eof
84
84
  attr_reader :req, :debug_output
85
85
  def initialize
86
86
  @started, @finished = 0, 0
@@ -1003,7 +1003,7 @@ class TestNetHttpPersistent < Minitest::Test
1003
1003
 
1004
1004
  # There's some roounding issue on jruby preventing this from passing
1005
1005
  unless RUBY_PLATFORM == "java"
1006
- assert_in_delta Time.now, c.last_use
1006
+ assert_in_delta Time.now, c.last_use, 0.003
1007
1007
  end
1008
1008
 
1009
1009
  assert_equal 1, c.requests
@@ -1530,4 +1530,22 @@ class TestNetHttpPersistent < Minitest::Test
1530
1530
  connection.close
1531
1531
  end
1532
1532
  end
1533
+
1534
+ def test_ignore_eof
1535
+ @http.ignore_eof = true
1536
+
1537
+ connection
1538
+
1539
+ @http.connection_for @uri do |c|
1540
+ assert c.http.ignore_eof
1541
+ end
1542
+
1543
+ @http.ignore_eof = false
1544
+
1545
+ connection
1546
+
1547
+ @http.connection_for @uri do |c|
1548
+ assert !c.http.ignore_eof
1549
+ end
1550
+ end
1533
1551
  end
@@ -29,7 +29,7 @@ class TestNetHttpPersistentTimedStackMulti < Minitest::Test
29
29
 
30
30
  assert_empty stack
31
31
 
32
- stack.push connection_args: popped
32
+ stack.push popped, connection_args: 'default'
33
33
 
34
34
  refute_empty stack
35
35
  end
@@ -43,7 +43,7 @@ class TestNetHttpPersistentTimedStackMulti < Minitest::Test
43
43
 
44
44
  assert_equal 0, stack.length
45
45
 
46
- stack.push connection_args: popped
46
+ stack.push popped, connection_args: 'default'
47
47
 
48
48
  assert_equal 1, stack.length
49
49
  end
@@ -113,7 +113,7 @@ class TestNetHttpPersistentTimedStackMulti < Minitest::Test
113
113
 
114
114
  conn = stack.pop
115
115
 
116
- stack.push connection_args: conn
116
+ stack.push conn, connection_args: 'default'
117
117
 
118
118
  refute_empty stack
119
119
  end
@@ -125,14 +125,16 @@ class TestNetHttpPersistentTimedStackMulti < Minitest::Test
125
125
  called << object
126
126
  end
127
127
 
128
- @stack.push connection_args: Object.new
128
+ obj = Object.new
129
+ @stack.push obj, connection_args: 'default'
129
130
 
130
131
  refute_empty called
131
132
  assert_empty @stack
132
133
  end
133
134
 
134
135
  def test_shutdown
135
- @stack.push connection_args: Object.new
136
+ obj = Object.new
137
+ @stack.push obj, connection_args: 'default'
136
138
 
137
139
  called = []
138
140
 
metadata CHANGED
@@ -1,34 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-http-persistent
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.6
4
+ version: 4.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-29 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: connection_pool
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '2.2'
19
16
  - - ">="
20
17
  - !ruby/object:Gem::Version
21
18
  version: 2.2.4
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '4'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '2.2'
29
26
  - - ">="
30
27
  - !ruby/object:Gem::Version
31
28
  version: 2.2.4
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '4'
32
+ - !ruby/object:Gem::Dependency
33
+ name: cgi
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: 0.5.1
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - "~>"
44
+ - !ruby/object:Gem::Version
45
+ version: 0.5.1
32
46
  description: |-
33
47
  Manages persistent connections using Net::HTTP including a thread pool for
34
48
  connecting to multiple hosts.
@@ -84,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
98
  - !ruby/object:Gem::Version
85
99
  version: '0'
86
100
  requirements: []
87
- rubygems_version: 3.6.0.dev
101
+ rubygems_version: 4.0.3
88
102
  specification_version: 4
89
103
  summary: Manages persistent connections using Net::HTTP including a thread pool for
90
104
  connecting to multiple hosts