net-http-persistent 4.0.6 → 4.0.8
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e1c40dff68b8e70cac3630ca6b19ff70679fe7462974c835bb8638ab2b5dd5b
|
|
4
|
+
data.tar.gz: 95185bc4624e14eaae5b31e65a7b8e474a07f621020a5096966ccfec200bf6f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32089ec62a29518f3d6b1e9f1a1a677b65b1cc3b937506a9e3f985455f8c924b0c37c80516e9adc23420f8d25932607c4975cc042ec217bbd5bed2c626c2a57b
|
|
7
|
+
data.tar.gz: 28fc74bc92b2f63f752dfc8a2e86971f76b3cb064fe3647949005f9f1d7fa41d48d26122dd6f4c9d137d5255cd1b3dedc09ed779c937d12597fb9baba6c325e7
|
|
@@ -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
|
-
|
|
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
|
data/lib/net/http/persistent.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'net/http'
|
|
2
2
|
require 'uri'
|
|
3
|
-
require 'cgi'
|
|
3
|
+
require 'cgi/escape'
|
|
4
|
+
require 'cgi/util' unless defined?(CGI::EscapeExt)
|
|
4
5
|
require 'connection_pool'
|
|
5
6
|
|
|
6
7
|
begin
|
|
@@ -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.8'
|
|
185
186
|
|
|
186
187
|
##
|
|
187
188
|
# Error class for errors raised by Net::HTTP::Persistent. Various
|
|
@@ -476,6 +477,13 @@ class Net::HTTP::Persistent
|
|
|
476
477
|
|
|
477
478
|
attr_reader :verify_hostname
|
|
478
479
|
|
|
480
|
+
|
|
481
|
+
##
|
|
482
|
+
# Sets whether to ignore end-of-file when reading a response body
|
|
483
|
+
# with Content-Length headers.
|
|
484
|
+
|
|
485
|
+
attr_accessor :ignore_eof
|
|
486
|
+
|
|
479
487
|
##
|
|
480
488
|
# Creates a new Net::HTTP::Persistent.
|
|
481
489
|
#
|
|
@@ -515,6 +523,7 @@ class Net::HTTP::Persistent
|
|
|
515
523
|
@max_retries = 1
|
|
516
524
|
@socket_options = []
|
|
517
525
|
@ssl_generation = 0 # incremented when SSL session variables change
|
|
526
|
+
@ignore_eof = nil
|
|
518
527
|
|
|
519
528
|
@socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
|
|
520
529
|
Socket.const_defined? :TCP_NODELAY
|
|
@@ -643,6 +652,7 @@ class Net::HTTP::Persistent
|
|
|
643
652
|
reset connection
|
|
644
653
|
end
|
|
645
654
|
|
|
655
|
+
http.ignore_eof = @ignore_eof if @ignore_eof
|
|
646
656
|
http.keep_alive_timeout = @idle_timeout if @idle_timeout
|
|
647
657
|
http.max_retries = @max_retries if http.respond_to?(:max_retries=)
|
|
648
658
|
http.read_timeout = @read_timeout if @read_timeout
|
|
@@ -826,7 +836,7 @@ class Net::HTTP::Persistent
|
|
|
826
836
|
@proxy_connection_id = [nil, *@proxy_args].join ':'
|
|
827
837
|
|
|
828
838
|
if @proxy_uri.query then
|
|
829
|
-
@no_proxy =
|
|
839
|
+
@no_proxy = URI.decode_www_form(@proxy_uri.query).filter_map { |k, v| v if k == 'no_proxy' }.join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? }
|
|
830
840
|
end
|
|
831
841
|
end
|
|
832
842
|
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
136
|
+
obj = Object.new
|
|
137
|
+
@stack.push obj, connection_args: 'default'
|
|
136
138
|
|
|
137
139
|
called = []
|
|
138
140
|
|
metadata
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Hodel
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
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
32
|
description: |-
|
|
33
33
|
Manages persistent connections using Net::HTTP including a thread pool for
|
|
34
34
|
connecting to multiple hosts.
|
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
85
|
version: '0'
|
|
86
86
|
requirements: []
|
|
87
|
-
rubygems_version:
|
|
87
|
+
rubygems_version: 4.0.3
|
|
88
88
|
specification_version: 4
|
|
89
89
|
summary: Manages persistent connections using Net::HTTP including a thread pool for
|
|
90
90
|
connecting to multiple hosts
|