net-http-persistent 3.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +14 -0
- data/History.txt +89 -1
- data/Manifest.txt +1 -1
- data/README.rdoc +9 -9
- data/Rakefile +20 -22
- data/lib/net/http/persistent/connection.rb +1 -0
- data/lib/net/http/persistent/pool.rb +23 -8
- data/lib/net/http/persistent/timed_stack_multi.rb +11 -1
- data/lib/net/http/persistent.rb +99 -193
- data/test/test_net_http_persistent.rb +77 -208
- data/test/test_net_http_persistent_timed_stack_multi.rb +1 -1
- metadata +16 -62
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9123e98741595dbcc1c9a9713ecdcfb517597dc52791dc546bd868c31cbe88d0
|
4
|
+
data.tar.gz: 462f4ae1dd63c8776ac18e3eab2b8e4c43e65d906722086a670d5ae3b764eb2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e3ea77d23e8c9829bba490c61546b71a221194cf8106bbb32ad746408283df04923649aef952d7317f06475a0a5466b19376c7a38e8b62490d65f24b6031cf
|
7
|
+
data.tar.gz: e46564075c2d655e258c5fd9ff3c45843b48c5bd6d8c5f80fe84450a36e7ac5811d0f97b5e8223277c2b607e7259df70e1e331c372e12a4bd33efec0e555e743
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
source "https://rubygems.org/"
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
gem "rake", "~>13.0"
|
8
|
+
gem "minitest", "~>5.15", :group => [:development, :test]
|
9
|
+
gem "rdoc", ">=4.0", "<7", :group => [:development, :test]
|
10
|
+
gem "rake-manifest", "~>0.2"
|
11
|
+
|
12
|
+
gem 'net-http-pipeline', '~> 1.0' if ENV['CI_MATRIX'] == 'pipeline'
|
13
|
+
|
14
|
+
# vim: syntax=ruby
|
data/History.txt
CHANGED
@@ -1,4 +1,92 @@
|
|
1
|
-
===
|
1
|
+
=== 4.0.2 / 2023-03-29
|
2
|
+
|
3
|
+
Bug fixes:
|
4
|
+
|
5
|
+
* Fix compatibility with `connection_pool 2.4+`
|
6
|
+
|
7
|
+
=== 4.0.1 / 2021-01-12
|
8
|
+
|
9
|
+
Bug fixes:
|
10
|
+
|
11
|
+
* Loosen Ruby version requirement so Ruby 3.0 will work.
|
12
|
+
|
13
|
+
=== 4.0.0 / 2020-04-30
|
14
|
+
|
15
|
+
Breaking changes:
|
16
|
+
|
17
|
+
* Removed built-in support for retrying failed requests as Net::HTTP has this
|
18
|
+
built-in for all supported versions. Pull request #100 by Michael Grosser.
|
19
|
+
* Dropped support for EoL ruby versions (< 2.4). Future feature releases may
|
20
|
+
drop support for ruby versions that are at end-of-life or in security-only
|
21
|
+
maintenance mode with any release. Pull request #113 by David Rodríguez
|
22
|
+
|
23
|
+
New features:
|
24
|
+
|
25
|
+
* Added Net::HTTP::Persistent#max_retries= to configure the number of retries
|
26
|
+
performed on a request for ruby versions that support it (2.5+).
|
27
|
+
* URI-ness is determined through #respond_to? to allow compatibility with
|
28
|
+
Addressable::URI. Pull request #67 by Ryan McKern.
|
29
|
+
* Use require_relative to reduce patch burden for vendored versions. Pull
|
30
|
+
Request #106 by David Rodríguez
|
31
|
+
|
32
|
+
Bug fixes:
|
33
|
+
|
34
|
+
* Stop wasting a connection when the keep-alive timeout is less than the idle
|
35
|
+
timeout. Pull request #115 by Yap Sok Ann.
|
36
|
+
* Improved use of URI#hostname for IPv6 connections. Pull request #76 by
|
37
|
+
Tomas Koutsky.
|
38
|
+
* Improved check for Process::RLIMIT_NOFILE support. Pull request #109 by Vít
|
39
|
+
Ondruch.
|
40
|
+
* Fix namespace in comments for escape/unescape wrappers. Pull request #114
|
41
|
+
by David Rodríguez.
|
42
|
+
* Fix History.txt timestamp for 3.0.0 release. Pull request #107 by Joe Van
|
43
|
+
Dyk.
|
44
|
+
* Fix link to PR #98 in 3.1.0 release notes. Pull request #110 by Justin
|
45
|
+
Reid.
|
46
|
+
|
47
|
+
Other:
|
48
|
+
|
49
|
+
* Updated Net::HTTP::Persistent#reconnect documentation to indicate that all
|
50
|
+
connections are reset. Issue #117 by Taisuke Miyazaki.
|
51
|
+
|
52
|
+
=== 3.1.0 / 2019-07-24
|
53
|
+
|
54
|
+
New features:
|
55
|
+
* Support ruby 2.6 Net::HTTP#write_timeout=. Pull request #99 by Víctor
|
56
|
+
Roldán Betancort.
|
57
|
+
* Support setting TLS min/max version. Pull request #94 by Bart.
|
58
|
+
|
59
|
+
Bug fixes:
|
60
|
+
* Reduce potential for memory leak through Hash default proc bindings. Pull
|
61
|
+
request #64 by Dominic Metzger.
|
62
|
+
* Test proxy auto detection from no_proxy in ENV. Pull request #60 by
|
63
|
+
HINOHARA Hiroshi.
|
64
|
+
* Add missing timestamp for 3.0 release. Pull request #78 by Joe Van Dyk.
|
65
|
+
* Support IPv6 URLs in proxy checks. Pull request #82 by Nicolás Sanguinetti.
|
66
|
+
* Use Net::HTTPGenericRequest#method to check idempotence for improved
|
67
|
+
compatibility. Pull request #83 by Fotos Georgiadis.
|
68
|
+
* Run net-http-pipeline tests in travis. Pull request #86 by T.J. Schuck.
|
69
|
+
* Correct +no_proxy+ support to override Net::HTTP proxy fallback. Pull
|
70
|
+
request #88 by Jared Kauppila.
|
71
|
+
* Mitigate memory leak when combined with faraday. Pull request #105 by Yohei
|
72
|
+
Kitamura.
|
73
|
+
* Set default connection pool size for Windows. Pull request #90 by Jared
|
74
|
+
Kauppila.
|
75
|
+
* Fix missing +name:+ argument in documentation. Pull requests #85 by T.J.
|
76
|
+
Schuck, #84 by James White.
|
77
|
+
* Fix memory leak from connection pooling. Pull request #98 by Aaron
|
78
|
+
Patterson.
|
79
|
+
* Update tests for minitest assert_equal deprecation. Pull request #92 by
|
80
|
+
Olle Jonsson.
|
81
|
+
* Fix typo in Net::HTTP::Persistent#pipeline. Pull request #91 by Kazuma
|
82
|
+
Furuhashi.
|
83
|
+
|
84
|
+
Other:
|
85
|
+
* Added bundler hoe plugin. Pull request #103 by Michael Grosser.
|
86
|
+
* Updated ruby versions in Travis CI. Pull request #93 by Olle Jonsson. Pull
|
87
|
+
request #103 by Michael Grosser.
|
88
|
+
|
89
|
+
=== 3.0 / 2016-10-05
|
2
90
|
|
3
91
|
Breaking changes:
|
4
92
|
|
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
= net-http-persistent
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
home :: https://github.com/drbrain/net-http-persistent
|
4
|
+
rdoc :: https://rdoc.info/gems/net-http-persistent
|
5
5
|
|
6
6
|
== DESCRIPTION:
|
7
7
|
|
8
|
-
Manages persistent connections using Net::HTTP
|
9
|
-
|
8
|
+
Manages persistent connections using Net::HTTP including a thread pool for
|
9
|
+
connecting to multiple hosts.
|
10
10
|
|
11
11
|
Using persistent HTTP connections can dramatically increase the speed of HTTP.
|
12
12
|
Creating a new HTTP connection for every request involves an extra TCP
|
13
13
|
round-trip and causes TCP congestion avoidance negotiation to start over.
|
14
14
|
|
15
15
|
Net::HTTP supports persistent connections with some API methods but does not
|
16
|
-
|
17
|
-
and
|
16
|
+
make setting up a single persistent connection or managing multiple
|
17
|
+
connections easy. Net::HTTP::Persistent wraps Net::HTTP and allows you to
|
18
|
+
focus on how to make HTTP requests.
|
18
19
|
|
19
20
|
== FEATURES/PROBLEMS:
|
20
21
|
|
21
|
-
* Supports
|
22
|
+
* Supports TLS with secure defaults
|
22
23
|
* Thread-safe
|
23
24
|
* Pure ruby
|
24
|
-
* Timeout-less speed boost for Ruby 1.8 (by Aaron Patterson)
|
25
25
|
|
26
26
|
== SYNOPSIS
|
27
27
|
|
@@ -60,7 +60,7 @@ including SSL connection verification, header handling and tunable options.
|
|
60
60
|
|
61
61
|
(The MIT License)
|
62
62
|
|
63
|
-
Copyright (c)
|
63
|
+
Copyright (c) Eric Hodel, Aaron Patterson
|
64
64
|
|
65
65
|
Permission is hereby granted, free of charge, to any person obtaining
|
66
66
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -1,27 +1,25 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
dependency 'connection_pool', '~> 2.2'
|
24
|
-
dependency 'minitest', '~> 5.2', :development
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
|
5
|
+
require "rake/testtask"
|
6
|
+
|
7
|
+
Rake::TestTask.new
|
8
|
+
|
9
|
+
require "rake/manifest"
|
10
|
+
|
11
|
+
Rake::Manifest::Task.new do |t|
|
12
|
+
t.patterns = [
|
13
|
+
".autotest",
|
14
|
+
".gemtest",
|
15
|
+
".travis.yml",
|
16
|
+
"Gemfile",
|
17
|
+
"History.txt",
|
18
|
+
"Manifest.txt",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"{test,lib}/**/*"
|
22
|
+
]
|
25
23
|
end
|
26
24
|
|
27
25
|
# vim: syntax=Ruby
|
@@ -11,17 +11,32 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def checkin net_http_args
|
14
|
-
|
14
|
+
if net_http_args.is_a?(Hash) && net_http_args.size == 1 && net_http_args[:force]
|
15
|
+
# ConnectionPool 2.4+ calls `checkin(force: true)` after fork.
|
16
|
+
# When this happens, we should remove all connections from Thread.current
|
17
|
+
if stacks = Thread.current[@key]
|
18
|
+
stacks.each do |http_args, connections|
|
19
|
+
connections.each do |conn|
|
20
|
+
@available.push conn, connection_args: http_args
|
21
|
+
end
|
22
|
+
connections.clear
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
stack = Thread.current[@key][net_http_args] ||= []
|
15
27
|
|
16
|
-
|
17
|
-
|
28
|
+
raise ConnectionPool::Error, 'no connections are checked out' if
|
29
|
+
stack.empty?
|
18
30
|
|
19
|
-
|
31
|
+
conn = stack.pop
|
20
32
|
|
21
|
-
|
22
|
-
|
23
|
-
end
|
33
|
+
if stack.empty?
|
34
|
+
@available.push conn, connection_args: net_http_args
|
24
35
|
|
36
|
+
Thread.current[@key].delete(net_http_args)
|
37
|
+
Thread.current[@key] = nil if Thread.current[@key].empty?
|
38
|
+
end
|
39
|
+
end
|
25
40
|
nil
|
26
41
|
end
|
27
42
|
|
@@ -46,5 +61,5 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
|
|
46
61
|
end
|
47
62
|
end
|
48
63
|
|
49
|
-
|
64
|
+
require_relative 'timed_stack_multi'
|
50
65
|
|
@@ -1,10 +1,20 @@
|
|
1
1
|
class Net::HTTP::Persistent::TimedStackMulti < ConnectionPool::TimedStack # :nodoc:
|
2
2
|
|
3
|
+
##
|
4
|
+
# Returns a new hash that has arrays for keys
|
5
|
+
#
|
6
|
+
# Using a class method to limit the bindings referenced by the hash's
|
7
|
+
# default_proc
|
8
|
+
|
9
|
+
def self.hash_of_arrays # :nodoc:
|
10
|
+
Hash.new { |h,k| h[k] = [] }
|
11
|
+
end
|
12
|
+
|
3
13
|
def initialize(size = 0, &block)
|
4
14
|
super
|
5
15
|
|
6
16
|
@enqueued = 0
|
7
|
-
@ques =
|
17
|
+
@ques = self.class.hash_of_arrays
|
8
18
|
@lru = {}
|
9
19
|
@key = :"connection_args-#{object_id}"
|
10
20
|
end
|