net-http-persistent 3.1.0 → 4.0.0

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
2
  SHA256:
3
- metadata.gz: 8dc2ad1abe3b0e82c9a23ed65f74425262d7ef4209768c8e309af861628179d9
4
- data.tar.gz: d34075303f6bbb7483bfd05e8054ecbd839a371c6ef5d29c844d21bd50834316
3
+ metadata.gz: 33e30717daf3230e2432295be22f54e49cae5fda06ee56ccff86b97da785a842
4
+ data.tar.gz: 903437046b46bf3c2b7381abe4ac8b45347ccc732095f620033d860abf48dbf6
5
5
  SHA512:
6
- metadata.gz: ed24bcd001852e4ade23285d7a7912735d8db4e1f6088e0ea0b8e037c49035fc2dce0efba6e0326a8a745453f503a6f23bf52fe472995dcc9d9ada7b6e177991
7
- data.tar.gz: 73f7dffd85bbe34cc71086aa352e12cd203b26480126b1f9dfefe4c722215dbcae9707bcfcb6b880c1f542cb2b1299e7a423f18504aa9964c9ac2ba3b6300325
6
+ metadata.gz: f578761fe5a7fb8a5fc7887a4cf798d7ba016bb8d471870d68f0ff6147904c10f9e2bb2f8456c7045a755c8e3168f43bd72cac204c935d2ba78dbc0172b21a17
7
+ data.tar.gz: a01ef587f907aae73483401ed61a78f30e8ce0da3661a40a39b29924446107d13c3678792c62bc1d5c53196e85345c11728c714d703bfb281bf63c6d4bb14b7a
@@ -1,2 +1 @@
1
- x"%<���5������?�^_���ru�/]�-��>ʝ�qH�O�R,��0����$W N�Xζ~���o�^��Z�7,���0�J�A�8ڽ0�]�m�M����v9�74��m _na���)���'+�o��X6-k���'�_
2
- h����.��*�R|R U�Ջ��;�o"��Xe0 �k�3�шɑ�p�����wo�ΪK��C�dÈ%aIFD�C�`(.,"[�g���_�+��ŵ�s�Ъ�
1
+ ,ar��O�C��3���pu�9�����1���WR���u'ђ�,����-�R����0��м��)AVv�ӧ��8Xn1��?�z��%k�����3��
2
+ Ϫ+lW2��RN��<D��a�w�惐R:p�*!��U���co��M�8u(�a������O.K��˝}�>���Q甶+D��v�إB�,�Yq!^^��t�9.Ӽ�O`���.t)\�H9���<�~��'��ڈ����D�*
data.tar.gz.sig CHANGED
Binary file
@@ -9,16 +9,15 @@ notifications:
9
9
  email:
10
10
  - drbrain@segment7.net
11
11
  rvm:
12
- - 2.1
13
- - 2.2
14
12
  - 2.3
15
13
  - 2.4
16
14
  - 2.5
17
15
  - 2.6
16
+ - 2.7
18
17
  script: rake travis
19
18
  install: "" # avoid running default bundler install
20
19
 
21
20
  matrix:
22
21
  include:
23
- - rvm: "2.6"
22
+ - rvm: "2.7"
24
23
  env: TRAVIS_MATRIX=pipeline
@@ -1,4 +1,43 @@
1
- === 3.1.0 2019-07-24
1
+ === 4.0.0 / 2020-04-30
2
+
3
+ Breaking changes:
4
+
5
+ * Removed built-in support for retrying failed requests as Net::HTTP has this
6
+ built-in for all supported versions. Pull request #100 by Michael Grosser.
7
+ * Dropped support for EoL ruby versions (< 2.4). Future feature releases may
8
+ drop support for ruby versions that are at end-of-life or in security-only
9
+ maintenance mode with any release. Pull request #113 by David Rodríguez
10
+
11
+ New features:
12
+
13
+ * Added Net::HTTP::Persistent#max_retries= to configure the number of retries
14
+ performed on a request for ruby versions that support it (2.5+).
15
+ * URI-ness is determined through #respond_to? to allow compatibility with
16
+ Addressable::URI. Pull request #67 by Ryan McKern.
17
+ * Use require_relative to reduce patch burden for vendored versions. Pull
18
+ Request #106 by David Rodríguez
19
+
20
+ Bug fixes:
21
+
22
+ * Stop wasting a connection when the keep-alive timeout is less than the idle
23
+ timeout. Pull request #115 by Yap Sok Ann.
24
+ * Improved use of URI#hostname for IPv6 connections. Pull request #76 by
25
+ Tomas Koutsky.
26
+ * Improved check for Process::RLIMIT_NOFILE support. Pull request #109 by Vít
27
+ Ondruch.
28
+ * Fix namespace in comments for escape/unescape wrappers. Pull request #114
29
+ by David Rodríguez.
30
+ * Fix History.txt timestamp for 3.0.0 release. Pull request #107 by Joe Van
31
+ Dyk.
32
+ * Fix link to PR #98 in 3.1.0 release notes. Pull request #110 by Justin
33
+ Reid.
34
+
35
+ Other:
36
+
37
+ * Updated Net::HTTP::Persistent#reconnect documentation to indicate that all
38
+ connections are reset. Issue #117 by Taisuke Miyazaki.
39
+
40
+ === 3.1.0 / 2019-07-24
2
41
 
3
42
  New features:
4
43
  * Support ruby 2.6 Net::HTTP#write_timeout=. Pull request #99 by Víctor
@@ -23,7 +62,7 @@ Bug fixes:
23
62
  Kauppila.
24
63
  * Fix missing +name:+ argument in documentation. Pull requests #85 by T.J.
25
64
  Schuck, #84 by James White.
26
- * Fix memory leak from connection pooling. Pull request #97 by Aaron
65
+ * Fix memory leak from connection pooling. Pull request #98 by Aaron
27
66
  Patterson.
28
67
  * Update tests for minitest assert_equal deprecation. Pull request #92 by
29
68
  Olle Jonsson.
@@ -35,7 +74,7 @@ Other:
35
74
  * Updated ruby versions in Travis CI. Pull request #93 by Olle Jonsson. Pull
36
75
  request #103 by Michael Grosser.
37
76
 
38
- === 3.0 2016-10-05
77
+ === 3.0 / 2016-10-05
39
78
 
40
79
  Breaking changes:
41
80
 
@@ -1,27 +1,27 @@
1
1
  = net-http-persistent
2
2
 
3
- * http://docs.seattlerb.org/net-http-persistent
4
- * https://github.com/drbrain/net-http-persistent
3
+ home :: https://github.com/drbrain/net-http-persistent
4
+ rdoc :: http://docs.seattlerb.org/net-http-persistent
5
5
 
6
6
  == DESCRIPTION:
7
7
 
8
- Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8.
9
- It's thread-safe too!
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
- handle reconnection gracefully. Net::HTTP::Persistent supports reconnection
17
- and retry according to RFC 2616.
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 SSL
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) 2010 Eric Hodel, Aaron Patterson
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
@@ -13,12 +13,12 @@ Hoe.spec 'net-http-persistent' do
13
13
  self.readme_file = 'README.rdoc'
14
14
  self.extra_rdoc_files += Dir['*.rdoc']
15
15
 
16
- self.require_ruby_version '~> 2.1'
16
+ self.require_ruby_version '~> 2.3'
17
17
 
18
18
  license 'MIT'
19
19
 
20
20
  rdoc_locations <<
21
- 'docs.seattlerb.org:/data/www/docs.seattlerb.org/net-http-persistent/'
21
+ 'docs-push.seattlerb.org:/data/www/docs.seattlerb.org/net-http-persistent/'
22
22
 
23
23
  dependency 'connection_pool', '~> 2.2'
24
24
  dependency 'minitest', '~> 5.2', :development
@@ -17,15 +17,11 @@ autoload :OpenSSL, 'openssl'
17
17
  # servers you wish to talk to. For each host:port you communicate with a
18
18
  # single persistent connection is created.
19
19
  #
20
- # Multiple Net::HTTP::Persistent objects will share the same set of
21
- # connections.
20
+ # Connections will be shared across threads through a connection pool to
21
+ # increase reuse of connections.
22
22
  #
23
- # For each thread you start a new connection will be created. A
24
- # Net::HTTP::Persistent connection will not be shared across threads.
25
- #
26
- # You can shut down the HTTP connections when done by calling #shutdown. You
27
- # should name your Net::HTTP::Persistent object if you intend to call this
28
- # method.
23
+ # You can shut down any remaining HTTP connections when done by calling
24
+ # #shutdown.
29
25
  #
30
26
  # Example:
31
27
  #
@@ -33,7 +29,7 @@ autoload :OpenSSL, 'openssl'
33
29
  #
34
30
  # uri = URI 'http://example.com/awesome/web/service'
35
31
  #
36
- # http = Net::HTTP::Persistent.new name: 'my_app_name'
32
+ # http = Net::HTTP::Persistent.new
37
33
  #
38
34
  # # perform a GET
39
35
  # response = http.request uri
@@ -55,14 +51,14 @@ autoload :OpenSSL, 'openssl'
55
51
  # to use URI#request_uri not URI#path. The request_uri contains the query
56
52
  # params which are sent in the body for other requests.
57
53
  #
58
- # == SSL
54
+ # == TLS/SSL
59
55
  #
60
- # SSL connections are automatically created depending upon the scheme of the
61
- # URI. SSL connections are automatically verified against the default
56
+ # TLS connections are automatically created depending upon the scheme of the
57
+ # URI. TLS connections are automatically verified against the default
62
58
  # certificate store for your computer. You can override this by changing
63
59
  # verify_mode or by specifying an alternate cert_store.
64
60
  #
65
- # Here are the SSL settings, see the individual methods for documentation:
61
+ # Here are the TLS settings, see the individual methods for documentation:
66
62
  #
67
63
  # #certificate :: This client's certificate
68
64
  # #ca_file :: The certificate-authorities
@@ -72,7 +68,7 @@ autoload :OpenSSL, 'openssl'
72
68
  # #private_key :: The client's SSL private key
73
69
  # #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
74
70
  # connection
75
- # #ssl_timeout :: SSL session lifetime
71
+ # #ssl_timeout :: Session lifetime
76
72
  # #ssl_version :: Which specific SSL version to use
77
73
  # #verify_callback :: For server certificate verification
78
74
  # #verify_depth :: Depth of certificate verification
@@ -101,14 +97,15 @@ autoload :OpenSSL, 'openssl'
101
97
  #
102
98
  # === Segregation
103
99
  #
104
- # By providing an application name to ::new you can separate your connections
105
- # from the connections of other applications.
100
+ # Each Net::HTTP::Persistent instance has its own pool of connections. There
101
+ # is no sharing with other instances (as was true in earlier versions).
106
102
  #
107
103
  # === Idle Timeout
108
104
  #
109
- # If a connection hasn't been used for this number of seconds it will automatically be
110
- # reset upon the next use to avoid attempting to send to a closed connection.
111
- # The default value is 5 seconds. nil means no timeout. Set through #idle_timeout.
105
+ # If a connection hasn't been used for this number of seconds it will
106
+ # automatically be reset upon the next use to avoid attempting to send to a
107
+ # closed connection. The default value is 5 seconds. nil means no timeout.
108
+ # Set through #idle_timeout.
112
109
  #
113
110
  # Reducing this value may help avoid the "too many connection resets" error
114
111
  # when sending non-idempotent requests while increasing this value will cause
@@ -123,8 +120,9 @@ autoload :OpenSSL, 'openssl'
123
120
  #
124
121
  # The number of requests that should be made before opening a new connection.
125
122
  # Typically many keep-alive capable servers tune this to 100 or less, so the
126
- # 101st request will fail with ECONNRESET. If unset (default), this value has no
127
- # effect, if set, connections will be reset on the request after max_requests.
123
+ # 101st request will fail with ECONNRESET. If unset (default), this value has
124
+ # no effect, if set, connections will be reset on the request after
125
+ # max_requests.
128
126
  #
129
127
  # === Open Timeout
130
128
  #
@@ -136,45 +134,6 @@ autoload :OpenSSL, 'openssl'
136
134
  # Socket options may be set on newly-created connections. See #socket_options
137
135
  # for details.
138
136
  #
139
- # === Non-Idempotent Requests
140
- #
141
- # By default non-idempotent requests will not be retried per RFC 2616. By
142
- # setting retry_change_requests to true requests will automatically be retried
143
- # once.
144
- #
145
- # Only do this when you know that retrying a POST or other non-idempotent
146
- # request is safe for your application and will not create duplicate
147
- # resources.
148
- #
149
- # The recommended way to handle non-idempotent requests is the following:
150
- #
151
- # require 'net/http/persistent'
152
- #
153
- # uri = URI 'http://example.com/awesome/web/service'
154
- # post_uri = uri + 'create'
155
- #
156
- # http = Net::HTTP::Persistent.new name: 'my_app_name'
157
- #
158
- # post = Net::HTTP::Post.new post_uri.path
159
- # # ... fill in POST request
160
- #
161
- # begin
162
- # response = http.request post_uri, post
163
- # rescue Net::HTTP::Persistent::Error
164
- #
165
- # # POST failed, make a new request to verify the server did not process
166
- # # the request
167
- # exists_uri = uri + '...'
168
- # response = http.get exists_uri
169
- #
170
- # # Retry if it failed
171
- # retry if response.code == '404'
172
- # end
173
- #
174
- # The method of determining if the resource was created or not is unique to
175
- # the particular service you are using. Of course, you will want to add
176
- # protection from infinite looping.
177
- #
178
137
  # === Connection Termination
179
138
  #
180
139
  # If you are done using the Net::HTTP::Persistent instance you may shut down
@@ -200,33 +159,20 @@ class Net::HTTP::Persistent
200
159
  HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
201
160
 
202
161
  ##
203
- # The default connection pool size is 1/4 the allowed open files.
162
+ # The default connection pool size is 1/4 the allowed open files
163
+ # (<code>ulimit -n</code>) or 256 if your OS does not support file handle
164
+ # limits (typically windows).
204
165
 
205
- if Gem.win_platform? then
206
- DEFAULT_POOL_SIZE = 256
207
- else
166
+ if Process.const_defined? :RLIMIT_NOFILE
208
167
  DEFAULT_POOL_SIZE = Process.getrlimit(Process::RLIMIT_NOFILE).first / 4
168
+ else
169
+ DEFAULT_POOL_SIZE = 256
209
170
  end
210
171
 
211
172
  ##
212
173
  # The version of Net::HTTP::Persistent you are using
213
174
 
214
- VERSION = '3.1.0'
215
-
216
- ##
217
- # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
218
- # the exception list for ruby 1.x.
219
-
220
- RETRIED_EXCEPTIONS = [ # :nodoc:
221
- (Net::ReadTimeout if Net.const_defined? :ReadTimeout),
222
- IOError,
223
- EOFError,
224
- Errno::ECONNRESET,
225
- Errno::ECONNABORTED,
226
- Errno::EPIPE,
227
- (OpenSSL::SSL::SSLError if HAVE_OPENSSL),
228
- Timeout::Error,
229
- ].compact
175
+ VERSION = '4.0.0'
230
176
 
231
177
  ##
232
178
  # Error class for errors raised by Net::HTTP::Persistent. Various
@@ -353,6 +299,13 @@ class Net::HTTP::Persistent
353
299
 
354
300
  attr_accessor :max_requests
355
301
 
302
+ ##
303
+ # Number of retries to perform if a request fails.
304
+ #
305
+ # See also #max_retries=, Net::HTTP#max_retries=.
306
+
307
+ attr_reader :max_retries
308
+
356
309
  ##
357
310
  # The value sent in the Keep-Alive header. Defaults to 30. Not needed for
358
311
  # HTTP/1.1 servers.
@@ -365,8 +318,7 @@ class Net::HTTP::Persistent
365
318
  attr_accessor :keep_alive
366
319
 
367
320
  ##
368
- # A name for this connection. Allows you to keep your connections apart
369
- # from everybody else's.
321
+ # The name for this collection of persistent connections.
370
322
 
371
323
  attr_reader :name
372
324
 
@@ -495,23 +447,11 @@ class Net::HTTP::Persistent
495
447
 
496
448
  attr_reader :verify_mode
497
449
 
498
- ##
499
- # Enable retries of non-idempotent requests that change data (e.g. POST
500
- # requests) when the server has disconnected.
501
- #
502
- # This will in the worst case lead to multiple requests with the same data,
503
- # but it may be useful for some applications. Take care when enabling
504
- # this option to ensure it is safe to POST or perform other non-idempotent
505
- # requests to the server.
506
-
507
- attr_accessor :retry_change_requests
508
-
509
450
  ##
510
451
  # Creates a new Net::HTTP::Persistent.
511
452
  #
512
- # Set +name+ to keep your connections apart from everybody else's. Not
513
- # required currently, but highly recommended. Your library name should be
514
- # good enough. This parameter will be required in a future version.
453
+ # Set a +name+ for fun. Your library name should be good enough, but this
454
+ # otherwise has no purpose.
515
455
  #
516
456
  # +proxy+ may be set to a URI::HTTP or :ENV to pick up proxy options from
517
457
  # the environment. See proxy_from_env for details.
@@ -524,8 +464,9 @@ class Net::HTTP::Persistent
524
464
  # proxy.password = 'hunter2'
525
465
  #
526
466
  # Set +pool_size+ to limit the maximum number of connections allowed.
527
- # Defaults to 1/4 the number of allowed file handles. You can have no more
528
- # than this many threads with active HTTP transactions.
467
+ # Defaults to 1/4 the number of allowed file handles or 256 if your OS does
468
+ # not support a limit on allowed file handles. You can have no more than
469
+ # this many threads with active HTTP transactions.
529
470
 
530
471
  def initialize name: nil, proxy: nil, pool_size: DEFAULT_POOL_SIZE
531
472
  @name = name
@@ -542,6 +483,7 @@ class Net::HTTP::Persistent
542
483
  @write_timeout = nil
543
484
  @idle_timeout = 5
544
485
  @max_requests = nil
486
+ @max_retries = 1
545
487
  @socket_options = []
546
488
  @ssl_generation = 0 # incremented when SSL session variables change
547
489
 
@@ -573,8 +515,6 @@ class Net::HTTP::Persistent
573
515
  @reuse_ssl_sessions = OpenSSL::SSL.const_defined? :Session
574
516
  end
575
517
 
576
- @retry_change_requests = false
577
-
578
518
  self.proxy = proxy if proxy
579
519
  end
580
520
 
@@ -635,7 +575,9 @@ class Net::HTTP::Persistent
635
575
 
636
576
  net_http_args = [uri.hostname, uri.port]
637
577
 
638
- if @proxy_uri and not proxy_bypass? uri.hostname, uri.port then
578
+ # I'm unsure if uri.host or uri.hostname should be checked against
579
+ # the proxy bypass list.
580
+ if @proxy_uri and not proxy_bypass? uri.host, uri.port then
639
581
  net_http_args.concat @proxy_args
640
582
  else
641
583
  net_http_args.concat [nil, nil, nil, nil]
@@ -655,9 +597,11 @@ class Net::HTTP::Persistent
655
597
  reset connection
656
598
  end
657
599
 
658
- http.read_timeout = @read_timeout if @read_timeout
659
- http.write_timeout = @write_timeout if @write_timeout && http.respond_to?(:write_timeout=)
660
- http.keep_alive_timeout = @idle_timeout if @idle_timeout
600
+ http.keep_alive_timeout = @idle_timeout if @idle_timeout
601
+ http.max_retries = @max_retries if http.respond_to?(:max_retries=)
602
+ http.read_timeout = @read_timeout if @read_timeout
603
+ http.write_timeout = @write_timeout if
604
+ @write_timeout && http.respond_to?(:write_timeout=)
661
605
 
662
606
  return yield connection
663
607
  rescue Errno::ECONNREFUSED
@@ -675,27 +619,14 @@ class Net::HTTP::Persistent
675
619
  end
676
620
 
677
621
  ##
678
- # Returns an error message containing the number of requests performed on
679
- # this connection
680
-
681
- def error_message connection
682
- connection.requests -= 1 # fixup
683
-
684
- age = Time.now - connection.last_use
685
-
686
- "after #{connection.requests} requests on #{connection.http.object_id}, " \
687
- "last used #{age} seconds ago"
688
- end
689
-
690
- ##
691
- # URI::escape wrapper
622
+ # CGI::escape wrapper
692
623
 
693
624
  def escape str
694
625
  CGI.escape str if str
695
626
  end
696
627
 
697
628
  ##
698
- # URI::unescape wrapper
629
+ # CGI::unescape wrapper
699
630
 
700
631
  def unescape str
701
632
  CGI.unescape str if str
@@ -738,6 +669,7 @@ class Net::HTTP::Persistent
738
669
  def finish connection
739
670
  connection.finish
740
671
 
672
+ connection.http.instance_variable_set :@last_communicated, nil
741
673
  connection.http.instance_variable_set :@ssl_session, nil unless
742
674
  @reuse_ssl_sessions
743
675
  end
@@ -746,31 +678,31 @@ class Net::HTTP::Persistent
746
678
  # Returns the HTTP protocol version for +uri+
747
679
 
748
680
  def http_version uri
749
- @http_versions["#{uri.host}:#{uri.port}"]
681
+ @http_versions["#{uri.hostname}:#{uri.port}"]
750
682
  end
751
683
 
752
684
  ##
753
- # Is +req+ idempotent according to RFC 2616?
685
+ # Adds "http://" to the String +uri+ if it is missing.
754
686
 
755
- def idempotent? req
756
- case req.method
757
- when 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE' then
758
- true
759
- end
687
+ def normalize_uri uri
688
+ (uri =~ /^https?:/) ? uri : "http://#{uri}"
760
689
  end
761
690
 
762
691
  ##
763
- # Is the request +req+ idempotent or is retry_change_requests allowed.
692
+ # Set the maximum number of retries for a request.
693
+ #
694
+ # Defaults to one retry.
695
+ #
696
+ # Set this to 0 to disable retries.
764
697
 
765
- def can_retry? req
766
- @retry_change_requests && !idempotent?(req)
767
- end
698
+ def max_retries= retries
699
+ retries = retries.to_int
768
700
 
769
- ##
770
- # Adds "http://" to the String +uri+ if it is missing.
701
+ raise ArgumentError, "max_retries must be positive" if retries < 0
771
702
 
772
- def normalize_uri uri
773
- (uri =~ /^https?:/) ? uri : "http://#{uri}"
703
+ @max_retries = retries
704
+
705
+ reconnect
774
706
  end
775
707
 
776
708
  ##
@@ -828,7 +760,7 @@ class Net::HTTP::Persistent
828
760
 
829
761
  if @proxy_uri then
830
762
  @proxy_args = [
831
- @proxy_uri.host,
763
+ @proxy_uri.hostname,
832
764
  @proxy_uri.port,
833
765
  unescape(@proxy_uri.user),
834
766
  unescape(@proxy_uri.password),
@@ -903,14 +835,15 @@ class Net::HTTP::Persistent
903
835
  end
904
836
 
905
837
  ##
906
- # Forces reconnection of HTTP connections.
838
+ # Forces reconnection of all HTTP connections, including TLS/SSL
839
+ # connections.
907
840
 
908
841
  def reconnect
909
842
  @generation += 1
910
843
  end
911
844
 
912
845
  ##
913
- # Forces reconnection of SSL connections.
846
+ # Forces reconnection of only TLS/SSL connections.
914
847
 
915
848
  def reconnect_ssl
916
849
  @ssl_generation += 1
@@ -943,14 +876,8 @@ class Net::HTTP::Persistent
943
876
  # the response will not have been read).
944
877
  #
945
878
  # +req+ must be a Net::HTTPGenericRequest subclass (see Net::HTTP for a list).
946
- #
947
- # If there is an error and the request is idempotent according to RFC 2616
948
- # it will be retried automatically.
949
879
 
950
880
  def request uri, req = nil, &block
951
- retried = false
952
- bad_response = false
953
-
954
881
  uri = URI uri
955
882
  req = request_setup req || uri
956
883
  response = nil
@@ -964,37 +891,12 @@ class Net::HTTP::Persistent
964
891
  response = http.request req, &block
965
892
 
966
893
  if req.connection_close? or
967
- (response.http_version <= '1.0' and
894
+ (response.http_version <= '1.0' and
968
895
  not response.connection_keep_alive?) or
969
- response.connection_close? then
896
+ response.connection_close? then
970
897
  finish connection
971
898
  end
972
- rescue Net::HTTPBadResponse => e
973
- message = error_message connection
974
-
975
- finish connection
976
-
977
- raise Error, "too many bad responses #{message}" if
978
- bad_response or not can_retry? req
979
-
980
- bad_response = true
981
- retry
982
- rescue *RETRIED_EXCEPTIONS => e
983
- request_failed e, req, connection if
984
- retried or not can_retry? req
985
-
986
- reset connection
987
-
988
- retried = true
989
- retry
990
- rescue Errno::EINVAL, Errno::ETIMEDOUT => e # not retried on ruby 2
991
- request_failed e, req, connection if retried or not can_retry? req
992
-
993
- reset connection
994
-
995
- retried = true
996
- retry
997
- rescue Exception => e
899
+ rescue Exception # make sure to close the connection when it was interrupted
998
900
  finish connection
999
901
 
1000
902
  raise
@@ -1003,26 +905,11 @@ class Net::HTTP::Persistent
1003
905
  end
1004
906
  end
1005
907
 
1006
- @http_versions["#{uri.host}:#{uri.port}"] ||= response.http_version
908
+ @http_versions["#{uri.hostname}:#{uri.port}"] ||= response.http_version
1007
909
 
1008
910
  response
1009
911
  end
1010
912
 
1011
- ##
1012
- # Raises an Error for +exception+ which resulted from attempting the request
1013
- # +req+ on the +connection+.
1014
- #
1015
- # Finishes the +connection+.
1016
-
1017
- def request_failed exception, req, connection # :nodoc:
1018
- due_to = "(due to #{exception.message} - #{exception.class})"
1019
- message = "too many connection resets #{due_to} #{error_message connection}"
1020
-
1021
- finish connection
1022
-
1023
- raise Error, message, exception.backtrace
1024
- end
1025
-
1026
913
  ##
1027
914
  # Creates a GET request if +req_or_uri+ is a URI and adds headers to the
1028
915
  # request.
@@ -1030,7 +917,7 @@ class Net::HTTP::Persistent
1030
917
  # Returns the request.
1031
918
 
1032
919
  def request_setup req_or_uri # :nodoc:
1033
- req = if URI === req_or_uri then
920
+ req = if req_or_uri.respond_to? 'request_uri' then
1034
921
  Net::HTTP::Get.new req_or_uri.request_uri
1035
922
  else
1036
923
  req_or_uri
@@ -1194,9 +1081,8 @@ application:
1194
1081
 
1195
1082
  reconnect_ssl
1196
1083
  end
1197
-
1198
1084
  end
1199
1085
 
1200
- require 'net/http/persistent/connection'
1201
- require 'net/http/persistent/pool'
1086
+ require_relative 'persistent/connection'
1087
+ require_relative 'persistent/pool'
1202
1088
 
@@ -49,5 +49,5 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
49
49
  end
50
50
  end
51
51
 
52
- require 'net/http/persistent/timed_stack_multi'
52
+ require_relative 'timed_stack_multi'
53
53
 
@@ -56,7 +56,8 @@ class TestNetHttpPersistent < Minitest::Test
56
56
  def setup
57
57
  @http = Net::HTTP::Persistent.new
58
58
 
59
- @uri = URI.parse 'http://example.com/path'
59
+ @uri = URI 'http://example.com/path'
60
+ @uri_v6 = URI 'http://[2001:db8::1]/path'
60
61
 
61
62
  ENV.delete 'http_proxy'
62
63
  ENV.delete 'HTTP_PROXY'
@@ -120,7 +121,7 @@ class TestNetHttpPersistent < Minitest::Test
120
121
  def basic_connection
121
122
  raise "#{@uri} is not HTTP" unless @uri.scheme.downcase == 'http'
122
123
 
123
- net_http_args = [@uri.host, @uri.port, nil, nil, nil, nil]
124
+ net_http_args = [@uri.hostname, @uri.port, nil, nil, nil, nil]
124
125
 
125
126
  connection = Net::HTTP::Persistent::Connection.allocate
126
127
  connection.ssl_generation = @http.ssl_generation
@@ -132,7 +133,9 @@ class TestNetHttpPersistent < Minitest::Test
132
133
  connection
133
134
  end
134
135
 
135
- def connection
136
+ def connection uri = @uri
137
+ @uri = uri
138
+
136
139
  connection = basic_connection
137
140
  connection.last_use = Time.now
138
141
 
@@ -152,7 +155,7 @@ class TestNetHttpPersistent < Minitest::Test
152
155
  def ssl_connection
153
156
  raise "#{@uri} is not HTTPS" unless @uri.scheme.downcase == 'https'
154
157
 
155
- net_http_args = [@uri.host, @uri.port, nil, nil, nil, nil]
158
+ net_http_args = [@uri.hostname, @uri.port, nil, nil, nil, nil]
156
159
 
157
160
  connection = Net::HTTP::Persistent::Connection.allocate
158
161
  connection.ssl_generation = @http.ssl_generation
@@ -220,26 +223,6 @@ class TestNetHttpPersistent < Minitest::Test
220
223
  assert_equal 1, @http.ssl_generation
221
224
  end
222
225
 
223
- def test_can_retry_eh_change_requests
224
- post = Net::HTTP::Post.new '/'
225
-
226
- refute @http.can_retry? post
227
-
228
- @http.retry_change_requests = true
229
-
230
- assert @http.can_retry? post
231
- end
232
-
233
- def test_can_retry_eh_idempotent
234
- head = Net::HTTP::Head.new '/'
235
-
236
- refute @http.can_retry? head
237
-
238
- post = Net::HTTP::Post.new '/'
239
-
240
- refute @http.can_retry? post
241
- end
242
-
243
226
  def test_cert_store_equals
244
227
  @http.cert_store = :cert_store
245
228
 
@@ -265,6 +248,7 @@ class TestNetHttpPersistent < Minitest::Test
265
248
  @http.open_timeout = 123
266
249
  @http.read_timeout = 321
267
250
  @http.idle_timeout = 42
251
+ @http.max_retries = 5
268
252
 
269
253
  used = @http.connection_for @uri do |c|
270
254
  assert_kind_of Net::HTTP, c.http
@@ -275,6 +259,7 @@ class TestNetHttpPersistent < Minitest::Test
275
259
  assert_equal 123, c.http.open_timeout
276
260
  assert_equal 321, c.http.read_timeout
277
261
  assert_equal 42, c.http.keep_alive_timeout
262
+ assert_equal 5, c.http.max_retries if c.http.respond_to?(:max_retries)
278
263
 
279
264
  c
280
265
  end
@@ -396,10 +381,8 @@ class TestNetHttpPersistent < Minitest::Test
396
381
  end
397
382
 
398
383
  def test_connection_for_ipv6
399
- uri = URI.parse 'https://[::1]/'
400
-
401
- @http.connection_for uri do |c|
402
- assert_equal '::1', c.http.address
384
+ @http.connection_for @uri_v6 do |c|
385
+ assert_equal '2001:db8::1', c.http.address
403
386
  end
404
387
  end
405
388
 
@@ -635,16 +618,6 @@ class TestNetHttpPersistent < Minitest::Test
635
618
  end
636
619
  end
637
620
 
638
- def test_error_message
639
- c = basic_connection
640
- c.last_use = Time.now - 1
641
- c.requests = 5
642
-
643
- message = @http.error_message c
644
- assert_match %r%after 4 requests on #{c.http.object_id}%, message
645
- assert_match %r%, last used [\d.]+ seconds ago%, message
646
- end
647
-
648
621
  def test_escape
649
622
  assert_nil @http.escape nil
650
623
 
@@ -698,6 +671,7 @@ class TestNetHttpPersistent < Minitest::Test
698
671
  def test_finish
699
672
  c = basic_connection
700
673
  c.requests = 5
674
+ c.http.instance_variable_set(:@last_communicated, Process.clock_gettime(Process::CLOCK_MONOTONIC))
701
675
 
702
676
  @http.finish c
703
677
 
@@ -706,6 +680,7 @@ class TestNetHttpPersistent < Minitest::Test
706
680
 
707
681
  assert_equal 0, c.requests
708
682
  assert_equal Net::HTTP::Persistent::EPOCH, c.last_use
683
+ assert_nil c.http.instance_variable_get(:@last_communicated)
709
684
  end
710
685
 
711
686
  def test_finish_io_error
@@ -743,24 +718,21 @@ class TestNetHttpPersistent < Minitest::Test
743
718
  assert_equal '1.1', @http.http_version(@uri)
744
719
  end
745
720
 
746
- def test_idempotent_eh
747
- assert @http.idempotent? Net::HTTP::Delete.new '/'
748
- assert @http.idempotent? Net::HTTP::Get.new '/'
749
- assert @http.idempotent? Net::HTTP::Head.new '/'
750
- assert @http.idempotent? Net::HTTP::Options.new '/'
751
- assert @http.idempotent? Net::HTTP::Put.new '/'
752
- assert @http.idempotent? Net::HTTP::Trace.new '/'
721
+ def test_http_version_IPv6
722
+ assert_nil @http.http_version @uri_v6
723
+
724
+ connection @uri_v6
753
725
 
754
- assert @http.idempotent? Net::HTTPGenericRequest.new('DELETE', false, true, '/')
755
- assert @http.idempotent? Net::HTTPGenericRequest.new('GET', false, true, '/')
756
- assert @http.idempotent? Net::HTTPGenericRequest.new('HEAD', false, false, '/')
757
- assert @http.idempotent? Net::HTTPGenericRequest.new('OPTIONS', false, false, '/')
758
- assert @http.idempotent? Net::HTTPGenericRequest.new('PUT', true, true, '/')
759
- assert @http.idempotent? Net::HTTPGenericRequest.new('TRACE', false, true, '/')
726
+ @http.request @uri_v6
727
+
728
+ assert_equal '1.1', @http.http_version(@uri_v6)
729
+ end
760
730
 
761
- refute @http.idempotent? Net::HTTP::Post.new '/'
731
+ def test_max_retries_equals
732
+ @http.max_retries = 5
762
733
 
763
- refute @http.idempotent? Net::HTTPGenericRequest.new('POST', true, true, '/')
734
+ assert_equal 5, @http.max_retries
735
+ assert_equal 1, @http.generation
764
736
  end
765
737
 
766
738
  def test_normalize_uri
@@ -832,6 +804,14 @@ class TestNetHttpPersistent < Minitest::Test
832
804
  assert_equal proxy_uri, @http.proxy_uri
833
805
  end
834
806
 
807
+ def test_proxy_equals_uri_IPv6
808
+ proxy_uri = @uri_v6
809
+
810
+ @http.proxy = proxy_uri
811
+
812
+ assert_equal proxy_uri, @http.proxy_uri
813
+ end
814
+
835
815
  def test_proxy_from_env
836
816
  ENV['http_proxy'] = 'proxy.example'
837
817
  ENV['http_proxy_user'] = 'johndoe'
@@ -977,7 +957,7 @@ class TestNetHttpPersistent < Minitest::Test
977
957
  assert_equal Net::HTTP::Persistent::EPOCH, used2.last_use
978
958
  end
979
959
 
980
- def test_request
960
+ def test_requestx
981
961
  @http.override_headers['user-agent'] = 'test ua'
982
962
  @http.headers['accept'] = 'text/*'
983
963
  c = connection
@@ -1001,62 +981,6 @@ class TestNetHttpPersistent < Minitest::Test
1001
981
  assert_equal 1, c.requests
1002
982
  end
1003
983
 
1004
- def test_request_ETIMEDOUT
1005
- c = basic_connection
1006
- def (c.http).request(*a) raise Errno::ETIMEDOUT, "timed out" end
1007
-
1008
- e = assert_raises Net::HTTP::Persistent::Error do
1009
- @http.request @uri
1010
- end
1011
-
1012
- assert_equal 0, c.requests
1013
- assert_match %r%too many connection resets%, e.message
1014
- end
1015
-
1016
- def test_request_bad_response
1017
- c = basic_connection
1018
- def (c.http).request(*a) raise Net::HTTPBadResponse end
1019
-
1020
- e = assert_raises Net::HTTP::Persistent::Error do
1021
- @http.request @uri
1022
- end
1023
-
1024
- assert_equal 0, c.requests
1025
- assert_match %r%too many bad responses%, e.message
1026
- end
1027
-
1028
- def test_request_bad_response_retry
1029
- c = basic_connection
1030
- def (c.http).request(*a)
1031
- raise Net::HTTPBadResponse
1032
- end
1033
-
1034
- assert_raises Net::HTTP::Persistent::Error do
1035
- @http.request @uri
1036
- end
1037
-
1038
- assert c.http.finished?
1039
- end
1040
-
1041
- def test_request_bad_response_unsafe
1042
- c = basic_connection
1043
- def (c.http).request(*a)
1044
- if instance_variable_defined? :@request then
1045
- raise 'POST must not be retried'
1046
- else
1047
- @request = true
1048
- raise Net::HTTPBadResponse
1049
- end
1050
- end
1051
-
1052
- e = assert_raises Net::HTTP::Persistent::Error do
1053
- @http.request @uri, Net::HTTP::Post.new(@uri.path)
1054
- end
1055
-
1056
- assert_equal 0, c.requests
1057
- assert_match %r%too many bad responses%, e.message
1058
- end
1059
-
1060
984
  def test_request_block
1061
985
  @http.headers['user-agent'] = 'test ua'
1062
986
  c = connection
@@ -1182,12 +1106,12 @@ class TestNetHttpPersistent < Minitest::Test
1182
1106
  c = basic_connection
1183
1107
  def (c.http).request(*a) raise Errno::EINVAL, "write" end
1184
1108
 
1185
- e = assert_raises Net::HTTP::Persistent::Error do
1109
+ e = assert_raises Errno::EINVAL do
1186
1110
  @http.request @uri
1187
1111
  end
1188
1112
 
1189
1113
  assert_equal 0, c.requests
1190
- assert_match %r%too many connection resets%, e.message
1114
+ assert_match %r%Invalid argument - write%, e.message
1191
1115
  end
1192
1116
 
1193
1117
  def test_request_post
@@ -1201,69 +1125,6 @@ class TestNetHttpPersistent < Minitest::Test
1201
1125
  assert_same post, req
1202
1126
  end
1203
1127
 
1204
- def test_request_reset
1205
- c = basic_connection
1206
- def (c.http).request(*a) raise Errno::ECONNRESET end
1207
-
1208
- e = assert_raises Net::HTTP::Persistent::Error do
1209
- @http.request @uri
1210
- end
1211
-
1212
- assert_equal 0, c.requests
1213
- assert_match %r%too many connection resets%, e.message
1214
- end
1215
-
1216
- def test_request_reset_retry
1217
- c = basic_connection
1218
- c.last_use = Time.now
1219
-
1220
- def (c.http).request(*a)
1221
- raise Errno::ECONNRESET
1222
- end
1223
-
1224
- assert_raises Net::HTTP::Persistent::Error do
1225
- @http.request @uri
1226
- end
1227
-
1228
- refute (c.http).reset?
1229
- assert (c.http).finished?
1230
- end
1231
-
1232
- def test_request_reset_unsafe
1233
- c = basic_connection
1234
- def (c.http).request(*a)
1235
- if instance_variable_defined? :@request then
1236
- raise 'POST must not be retried'
1237
- else
1238
- @request = true
1239
- raise Errno::ECONNRESET
1240
- end
1241
- end
1242
-
1243
- e = assert_raises Net::HTTP::Persistent::Error do
1244
- @http.request @uri, Net::HTTP::Post.new(@uri.path)
1245
- end
1246
-
1247
- assert_equal 0, c.requests
1248
- assert_match %r%too many connection resets%, e.message
1249
- end
1250
-
1251
- def test_request_ssl_error
1252
- skip 'OpenSSL is missing' unless HAVE_OPENSSL
1253
-
1254
- uri = URI.parse 'https://example.com/path'
1255
- @http.connection_for uri do |c|
1256
- def (c.http).request(*)
1257
- raise OpenSSL::SSL::SSLError, "SSL3_WRITE_PENDING:bad write retry"
1258
- end
1259
-
1260
- e = assert_raises Net::HTTP::Persistent::Error do
1261
- @http.request uri
1262
- end
1263
- assert_match %r%bad write retry%, e.message
1264
- end
1265
- end
1266
-
1267
1128
  def test_request_setup
1268
1129
  @http.override_headers['user-agent'] = 'test ua'
1269
1130
  @http.headers['accept'] = 'text/*'
@@ -1307,30 +1168,6 @@ class TestNetHttpPersistent < Minitest::Test
1307
1168
  assert_equal '/path?a=b', req.path
1308
1169
  end
1309
1170
 
1310
- def test_request_failed
1311
- c = basic_connection
1312
- c.requests = 1
1313
- c.last_use = Time.now
1314
-
1315
- original = nil
1316
-
1317
- begin
1318
- raise 'original'
1319
- rescue => original
1320
- end
1321
-
1322
- req = Net::HTTP::Get.new '/'
1323
-
1324
- e = assert_raises Net::HTTP::Persistent::Error do
1325
- @http.request_failed original, req, c
1326
- end
1327
-
1328
- assert_match "too many connection resets (due to original - RuntimeError)",
1329
- e.message
1330
-
1331
- assert_equal original.backtrace, e.backtrace
1332
- end
1333
-
1334
1171
  def test_reset
1335
1172
  c = basic_connection
1336
1173
  c.http.start
@@ -1385,23 +1222,6 @@ class TestNetHttpPersistent < Minitest::Test
1385
1222
  assert_match __FILE__, e.backtrace.first
1386
1223
  end
1387
1224
 
1388
- def test_retry_change_requests_equals
1389
- get = Net::HTTP::Get.new('/')
1390
- post = Net::HTTP::Post.new('/')
1391
-
1392
- refute @http.retry_change_requests
1393
-
1394
- refute @http.can_retry?(get)
1395
- refute @http.can_retry?(post)
1396
-
1397
- @http.retry_change_requests = true
1398
-
1399
- assert @http.retry_change_requests
1400
-
1401
- refute @http.can_retry?(get)
1402
- assert @http.can_retry?(post)
1403
- end
1404
-
1405
1225
  def test_shutdown
1406
1226
  c = connection
1407
1227
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-http-persistent
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDNjCCAh6gAwIBAgIBBjANBgkqhkiG9w0BAQsFADBBMRAwDgYDVQQDDAdkcmJy
13
+ MIIDNjCCAh6gAwIBAgIBBzANBgkqhkiG9w0BAQsFADBBMRAwDgYDVQQDDAdkcmJy
14
14
  YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
15
- ZXQwHhcNMTkwNDA4MjEwOTU2WhcNMjAwNDA3MjEwOTU2WjBBMRAwDgYDVQQDDAdk
15
+ ZXQwHhcNMjAwNDE0MDQxNjM0WhcNMjEwNDE0MDQxNjM0WjBBMRAwDgYDVQQDDAdk
16
16
  cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
17
17
  FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
18
18
  LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
@@ -21,15 +21,15 @@ cert_chain:
21
21
  mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
22
22
  g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
23
23
  sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
- BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQsFAAOCAQEAP5FfXeij
25
- /fkvIZDdN0LV1ES3Thqoz4aQFbJv1Gf3VccYMs7/Rop5oWBOtiHMIVc855bgv5fx
26
- uzRtuwiuiq1mZ6IZWkFnEw+vi+M6Q5e/8v+dhej1r7rPW71y4I1wH972O8qiuRXZ
27
- EVu1y+fPhNAu6OTMgVtgkijEuA9d4OQ2xusF/YKWkaVkjrdHcDAEaquxYUKrswxM
28
- DohqfAYWGDt2dmCWfRWTsBLm3p3R0mwKe8uOy4gSwcvG5SG57oSZoxrAN9CgsJoR
29
- P+3YOaiDtZ7g4lYXhpJrMooDnoWr4TPbGIVuq0xfPlFinjBH0o1W+LfGS+3aCN6b
30
- jT8g+1iKSQKJYA==
24
+ BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQsFAAOCAQEAcrJao+AD
25
+ qFvUtuvzimPGJS1rtKJEvEvDTzEOnd4e+R+mVitEBp3AI8R4OZGf1wnPy7jYYtiL
26
+ S8FhRBZRyXaQcvcL75eKicfIy8gPSg8d8YTs12BhXrF+ziTR6JJUB3DLkFjE3O84
27
+ Aid+DdQFk1ERR/GvpA9wQcax8DXzc9ONoN/kGdruXLtXSEwmOGJgmSV9iKK2Ot+x
28
+ 6A1NLSPq5zcsOzbmsaWlZphKnvH6oPqOLzMxwGJOz07/XXxICSYIccrWXdHZ3PPm
29
+ UpBFtcBdupJTrY8t+BLoVN4zTlNqoDciUJBjHfem/2CiMy6oDqthQva1Kn8fquIf
30
+ BHDiQW5MD5FN1g==
31
31
  -----END CERTIFICATE-----
32
- date: 2019-07-25 00:00:00.000000000 Z
32
+ date: 2020-05-01 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: connection_pool
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.11'
54
+ version: '5.14'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.11'
61
+ version: '5.14'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: hoe-bundler
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -119,25 +119,26 @@ dependencies:
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '3.17'
122
+ version: '3.22'
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '3.17'
129
+ version: '3.22'
130
130
  description: |-
131
- Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8.
132
- It's thread-safe too!
131
+ Manages persistent connections using Net::HTTP including a thread pool for
132
+ connecting to multiple hosts.
133
133
 
134
134
  Using persistent HTTP connections can dramatically increase the speed of HTTP.
135
135
  Creating a new HTTP connection for every request involves an extra TCP
136
136
  round-trip and causes TCP congestion avoidance negotiation to start over.
137
137
 
138
138
  Net::HTTP supports persistent connections with some API methods but does not
139
- handle reconnection gracefully. Net::HTTP::Persistent supports reconnection
140
- and retry according to RFC 2616.
139
+ make setting up a single persistent connection or managing multiple
140
+ connections easy. Net::HTTP::Persistent wraps Net::HTTP and allows you to
141
+ focus on how to make HTTP requests.
141
142
  email:
142
143
  - drbrain@segment7.net
143
144
  executables: []
@@ -161,10 +162,11 @@ files:
161
162
  - lib/net/http/persistent/timed_stack_multi.rb
162
163
  - test/test_net_http_persistent.rb
163
164
  - test/test_net_http_persistent_timed_stack_multi.rb
164
- homepage: http://docs.seattlerb.org/net-http-persistent
165
+ homepage: https://github.com/drbrain/net-http-persistent
165
166
  licenses:
166
167
  - MIT
167
- metadata: {}
168
+ metadata:
169
+ homepage_uri: https://github.com/drbrain/net-http-persistent
168
170
  post_install_message:
169
171
  rdoc_options:
170
172
  - "--main"
@@ -175,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
177
  requirements:
176
178
  - - "~>"
177
179
  - !ruby/object:Gem::Version
178
- version: '2.1'
180
+ version: '2.3'
179
181
  required_rubygems_version: !ruby/object:Gem::Requirement
180
182
  requirements:
181
183
  - - ">="
@@ -185,6 +187,6 @@ requirements: []
185
187
  rubygems_version: 3.0.3
186
188
  signing_key:
187
189
  specification_version: 4
188
- summary: Manages persistent connections using Net::HTTP plus a speed fix for Ruby
189
- 1.8
190
+ summary: Manages persistent connections using Net::HTTP including a thread pool for
191
+ connecting to multiple hosts
190
192
  test_files: []
metadata.gz.sig CHANGED
Binary file