net-http-persistent 2.8 → 2.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea7002c40a540ea921855f2b04c1862c0e501bb9
4
+ data.tar.gz: 2e542b3cbdc4752799409f8dd1ecbbbb1ee84f0a
5
+ SHA512:
6
+ metadata.gz: 591fb46b7ac365d1268935f44a449cdd4cfc56c64398d3e258baf7cd5e215fd213e42f5f9fcc5fdc032daae2dc93a34404833dd3a9afc6dc0ed4828547709f11
7
+ data.tar.gz: 3865436c02a8efecc81c335bb603d1ca2b540a3dde995df17f7dc844e38d0715279a02d4cf77128bff9f837380530e3d3487e3a396e05a6e1fa4936b904ea7cf
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- 4Dx�.�<
1
+ ��iB�����< WȌ���Kz�|t�*��{Ѳȇ��*M���T�M�BM�����VU�bMorv�#�D��m;7�%�7A��g��� O��q.S+�����W��"/���Q�a��\�TK��Lя�V��Q��wcy��L[�S���Ӽ'��]��Ap��KS}��/ ��,�Lz��I�R�}��y1�v$?$^*CH��B�h�Ú��E�O�qǥۉ6C�|g"�NJA��g��G(
data/.autotest CHANGED
@@ -3,5 +3,7 @@
3
3
  require 'autotest/restart'
4
4
 
5
5
  Autotest.add_hook :initialize do |at|
6
- at.testlib = 'minitest/unit'
6
+ at.add_exception '.git'
7
+ at.add_exception '.rdoc'
7
8
  end
9
+
@@ -1,3 +1,25 @@
1
+ === 2.9 / 2013-07-24
2
+
3
+ * Minor enhancement
4
+ * Added max_requests to avoid ECONNRESET for a server that allows a limited
5
+ number of requests on a connection. Pull request #42 by James Tucker.
6
+ * Request failures are now raised with the backtrace of the original
7
+ exception. This gives better insight into the reason for the failure.
8
+ See #41 by Andrew Cholakian.
9
+ * OpenSSL is no longer required. If OpenSSL is not available an exception
10
+ will be raised when attempting to access HTTPS resources. Feature request
11
+ by André Arko
12
+
13
+ * Bug fixes
14
+ * Explain the proper way of sending parameters depending upon the request
15
+ method. Issue #35 by André Arko.
16
+ * Handle Errno::ETIMEDOUT by retrying the request. Issue #36 by André Arko.
17
+ * Requests retried by ruby 2.x are no longer retried by net-http-persistent.
18
+ * Finish the connection if an otherwise unhandled exception happens during a
19
+ request. Bug #46 by Mark Oude Veldhuis.
20
+ * detect_idle_timeout now assumes a StandardError indicates the idle timeout
21
+ has been found. Bug #43 by James Tucker.
22
+
1
23
  === 2.8 / 2012-10-17
2
24
 
3
25
  * Minor enhancements
@@ -1,5 +1,9 @@
1
1
  require 'net/http'
2
- require 'net/https'
2
+ begin
3
+ require 'net/https'
4
+ rescue LoadError
5
+ # net/https or openssl
6
+ end if RUBY_VERSION < '1.9' # but only for 1.8
3
7
  require 'net/http/faster'
4
8
  require 'uri'
5
9
  require 'cgi' # for escaping
@@ -9,6 +13,8 @@ begin
9
13
  rescue LoadError
10
14
  end
11
15
 
16
+ autoload :OpenSSL, 'openssl'
17
+
12
18
  ##
13
19
  # Persistent connections for Net::HTTP
14
20
  #
@@ -37,6 +43,11 @@ end
37
43
  # # perform a GET
38
44
  # response = http.request uri
39
45
  #
46
+ # # or
47
+ #
48
+ # get = Net::HTTP::Get.new uri.request_uri
49
+ # response = http.request get
50
+ #
40
51
  # # create a POST
41
52
  # post_uri = uri + 'create'
42
53
  # post = Net::HTTP::Post.new post_uri.path
@@ -45,6 +56,10 @@ end
45
56
  # # perform the POST, the URI is always required
46
57
  # response http.request post_uri, post
47
58
  #
59
+ # Note that for GET, HEAD and other requests that do not have a body you want
60
+ # to use URI#request_uri not URI#path. The request_uri contains the query
61
+ # params which are sent in the body for other requests.
62
+ #
48
63
  # == SSL
49
64
  #
50
65
  # SSL connections are automatically created depending upon the scheme of the
@@ -105,6 +120,13 @@ end
105
120
  # The amount of time allowed between reading two chunks from the socket. Set
106
121
  # through #read_timeout
107
122
  #
123
+ # === Max Requests
124
+ #
125
+ # The number of requests that should be made before opening a new connection.
126
+ # Typically many keep-alive capable servers tune this to 100 or less, so the
127
+ # 101st request will fail with ECONNRESET. If unset (default), this value has no
128
+ # effect, if set, connections will be reset on the request after max_requests.
129
+ #
108
130
  # === Open Timeout
109
131
  #
110
132
  # The amount of time to wait for a connection to be opened. Set through
@@ -173,10 +195,30 @@ class Net::HTTP::Persistent
173
195
 
174
196
  EPOCH = Time.at 0 # :nodoc:
175
197
 
198
+ ##
199
+ # Is OpenSSL available? This test works with autoload
200
+
201
+ HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
202
+
176
203
  ##
177
204
  # The version of Net::HTTP::Persistent you are using
178
205
 
179
- VERSION = '2.8'
206
+ VERSION = '2.9'
207
+
208
+ ##
209
+ # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
210
+ # the exception list for ruby 1.x.
211
+
212
+ RETRIED_EXCEPTIONS = [ # :nodoc:
213
+ (Net::ReadTimeout if Net.const_defined? :ReadTimeout),
214
+ IOError,
215
+ EOFError,
216
+ Errno::ECONNRESET,
217
+ Errno::ECONNABORTED,
218
+ Errno::EPIPE,
219
+ (OpenSSL::SSL::SSLError if HAVE_OPENSSL),
220
+ Timeout::Error,
221
+ ].compact
180
222
 
181
223
  ##
182
224
  # Error class for errors raised by Net::HTTP::Persistent. Various
@@ -226,6 +268,8 @@ class Net::HTTP::Persistent
226
268
  $stderr.puts "sleeping #{sleep_time}" if $DEBUG
227
269
  sleep sleep_time
228
270
  end
271
+ rescue
272
+ # ignore StandardErrors, we've probably found the idle timeout.
229
273
  ensure
230
274
  http.shutdown
231
275
 
@@ -287,6 +331,12 @@ class Net::HTTP::Persistent
287
331
 
288
332
  attr_accessor :idle_timeout
289
333
 
334
+ ##
335
+ # Maximum number of requests on a connection before it is considered expired
336
+ # and automatically closed.
337
+
338
+ attr_accessor :max_requests
339
+
290
340
  ##
291
341
  # The value sent in the Keep-Alive header. Defaults to 30. Not needed for
292
342
  # HTTP/1.1 servers.
@@ -442,6 +492,7 @@ class Net::HTTP::Persistent
442
492
  @open_timeout = nil
443
493
  @read_timeout = nil
444
494
  @idle_timeout = 5
495
+ @max_requests = nil
445
496
  @socket_options = []
446
497
 
447
498
  @socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
@@ -458,15 +509,22 @@ class Net::HTTP::Persistent
458
509
  @private_key = nil
459
510
  @ssl_version = nil
460
511
  @verify_callback = nil
461
- @verify_mode = OpenSSL::SSL::VERIFY_PEER
512
+ @verify_mode = nil
462
513
  @cert_store = nil
463
514
 
464
515
  @generation = 0 # incremented when proxy URI changes
465
516
  @ssl_generation = 0 # incremented when SSL session variables change
466
- @reuse_ssl_sessions = OpenSSL::SSL.const_defined? :Session
517
+
518
+ if HAVE_OPENSSL then
519
+ @verify_mode = OpenSSL::SSL::VERIFY_PEER
520
+ @reuse_ssl_sessions = OpenSSL::SSL.const_defined? :Session
521
+ end
467
522
 
468
523
  @retry_change_requests = false
469
524
 
525
+ @ruby_1 = RUBY_VERSION < '2'
526
+ @retried_on_ruby_2 = !@ruby_1
527
+
470
528
  self.proxy = proxy if proxy
471
529
  end
472
530
 
@@ -536,6 +594,9 @@ class Net::HTTP::Persistent
536
594
  use_ssl = uri.scheme.downcase == 'https'
537
595
 
538
596
  if use_ssl then
597
+ raise Net::HTTP::Persistent::Error, 'OpenSSL is not available' unless
598
+ HAVE_OPENSSL
599
+
539
600
  ssl_generation = @ssl_generation
540
601
 
541
602
  ssl_cleanup ssl_generation
@@ -606,10 +667,12 @@ class Net::HTTP::Persistent
606
667
  end
607
668
 
608
669
  ##
609
- # Returns true if the connection should be reset due to an idle timeout,
610
- # false otherwise.
670
+ # Returns true if the connection should be reset due to an idle timeout, or
671
+ # maximum request count, false otherwise.
611
672
 
612
673
  def expired? connection
674
+ requests = Thread.current[@request_key][connection.object_id]
675
+ return true if @max_requests && requests >= @max_requests
613
676
  return false unless @idle_timeout
614
677
  return true if @idle_timeout.zero?
615
678
 
@@ -679,10 +742,15 @@ class Net::HTTP::Persistent
679
742
  end
680
743
 
681
744
  ##
682
- # Is the request idempotent or is retry_change_requests allowed
745
+ # Is the request +req+ idempotent or is retry_change_requests allowed.
746
+ #
747
+ # If +retried_on_ruby_2+ is true, true will be returned if we are on ruby,
748
+ # retry_change_requests is allowed and the request is not idempotent.
683
749
 
684
- def can_retry? req
685
- retry_change_requests or idempotent?(req)
750
+ def can_retry? req, retried_on_ruby_2 = false
751
+ return @retry_change_requests && !idempotent?(req) if retried_on_ruby_2
752
+
753
+ @retry_change_requests || idempotent?(req)
686
754
  end
687
755
 
688
756
  if RUBY_VERSION > '1.9' then
@@ -833,11 +901,11 @@ class Net::HTTP::Persistent
833
901
  env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
834
902
 
835
903
  # '*' is special case for always bypass
836
- return nil if env_no_proxy == '*'
904
+ return nil if env_no_proxy == '*'
837
905
 
838
906
  if env_no_proxy then
839
907
  uri.query = "no_proxy=#{escape(env_no_proxy)}"
840
- end
908
+ end
841
909
 
842
910
  unless uri.user or uri.password then
843
911
  uri.user = escape ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER']
@@ -901,27 +969,14 @@ class Net::HTTP::Persistent
901
969
  #
902
970
  # +req+ must be a Net::HTTPRequest subclass (see Net::HTTP for a list).
903
971
  #
904
- # If there is an error and the request is idempontent according to RFC 2616
972
+ # If there is an error and the request is idempotent according to RFC 2616
905
973
  # it will be retried automatically.
906
974
 
907
975
  def request uri, req = nil, &block
908
976
  retried = false
909
977
  bad_response = false
910
978
 
911
- req = Net::HTTP::Get.new uri.request_uri unless req
912
-
913
- @headers.each do |pair|
914
- req.add_field(*pair)
915
- end
916
-
917
- @override_headers.each do |name, value|
918
- req[name] = value
919
- end
920
-
921
- unless req['Connection'] then
922
- req.add_field 'Connection', 'keep-alive'
923
- req.add_field 'Keep-Alive', @keep_alive
924
- end
979
+ req = request_setup req || uri
925
980
 
926
981
  connection = connection_for uri
927
982
  connection_id = connection.object_id
@@ -946,23 +1001,25 @@ class Net::HTTP::Persistent
946
1001
 
947
1002
  bad_response = true
948
1003
  retry
949
- rescue IOError, EOFError, Timeout::Error,
950
- Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE,
951
- Errno::EINVAL, OpenSSL::SSL::SSLError => e
1004
+ rescue *RETRIED_EXCEPTIONS => e # retried on ruby 2
1005
+ request_failed e, req, connection if
1006
+ retried or not can_retry? req, @retried_on_ruby_2
952
1007
 
953
- if retried or not can_retry? req
954
- due_to = "(due to #{e.message} - #{e.class})"
955
- message = error_message connection
956
-
957
- finish connection
1008
+ reset connection
958
1009
 
959
- raise Error, "too many connection resets #{due_to} #{message}"
960
- end
1010
+ retried = true
1011
+ retry
1012
+ rescue Errno::EINVAL, Errno::ETIMEDOUT => e # not retried on ruby 2
1013
+ request_failed e, req, connection if retried or not can_retry? req
961
1014
 
962
1015
  reset connection
963
1016
 
964
1017
  retried = true
965
1018
  retry
1019
+ rescue Exception => e
1020
+ finish connection
1021
+
1022
+ raise
966
1023
  ensure
967
1024
  Thread.current[@timeout_key][connection_id] = Time.now
968
1025
  end
@@ -972,6 +1029,51 @@ class Net::HTTP::Persistent
972
1029
  response
973
1030
  end
974
1031
 
1032
+ ##
1033
+ # Raises an Error for +exception+ which resulted from attempting the request
1034
+ # +req+ on the +connection+.
1035
+ #
1036
+ # Finishes the +connection+.
1037
+
1038
+ def request_failed exception, req, connection # :nodoc:
1039
+ due_to = "(due to #{exception.message} - #{exception.class})"
1040
+ message = "too many connection resets #{due_to} #{error_message connection}"
1041
+
1042
+ finish connection
1043
+
1044
+
1045
+ raise Error, message, exception.backtrace
1046
+ end
1047
+
1048
+ ##
1049
+ # Creates a GET request if +req_or_uri+ is a URI and adds headers to the
1050
+ # request.
1051
+ #
1052
+ # Returns the request.
1053
+
1054
+ def request_setup req_or_uri # :nodoc:
1055
+ req = if URI === req_or_uri then
1056
+ Net::HTTP::Get.new req_or_uri.request_uri
1057
+ else
1058
+ req_or_uri
1059
+ end
1060
+
1061
+ @headers.each do |pair|
1062
+ req.add_field(*pair)
1063
+ end
1064
+
1065
+ @override_headers.each do |name, value|
1066
+ req[name] = value
1067
+ end
1068
+
1069
+ unless req['Connection'] then
1070
+ req.add_field 'Connection', 'keep-alive'
1071
+ req.add_field 'Keep-Alive', @keep_alive
1072
+ end
1073
+
1074
+ req
1075
+ end
1076
+
975
1077
  ##
976
1078
  # Shuts down all connections for +thread+.
977
1079
  #
@@ -1,9 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'minitest/autorun'
3
3
  require 'net/http/persistent'
4
- require 'openssl'
5
4
  require 'stringio'
6
5
 
6
+ HAVE_OPENSSL = defined?(OpenSSL::SSL)
7
+
7
8
  module Net::HTTP::Persistent::TestConnect
8
9
  def self.included mod
9
10
  mod.send :alias_method, :orig_connect, :connect
@@ -54,13 +55,15 @@ class Net::HTTP::Persistent::SSLReuse
54
55
  include Net::HTTP::Persistent::TestConnect
55
56
  end
56
57
 
57
- class TestNetHttpPersistent < MiniTest::Unit::TestCase
58
+ class TestNetHttpPersistent < Minitest::Test
59
+
60
+ RUBY_1 = RUBY_VERSION < '2'
58
61
 
59
62
  def setup
60
- @http_class = if RUBY_VERSION > '2.0' then
61
- Net::HTTP
62
- else
63
+ @http_class = if RUBY_1 and HAVE_OPENSSL then
63
64
  Net::HTTP::Persistent::SSLReuse
65
+ else
66
+ Net::HTTP
64
67
  end
65
68
 
66
69
  @http = Net::HTTP::Persistent.new
@@ -177,6 +180,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
177
180
 
178
181
  assert_empty @http.no_proxy
179
182
 
183
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
184
+
180
185
  ssl_session_exists = OpenSSL::SSL.const_defined? :Session
181
186
 
182
187
  assert_equal ssl_session_exists, @http.reuse_ssl_sessions
@@ -188,6 +193,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
188
193
  end
189
194
 
190
195
  def test_initialize_no_ssl_session
196
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
197
+
191
198
  skip "OpenSSL::SSL::Session does not exist on #{RUBY_PLATFORM}" unless
192
199
  OpenSSL::SSL.const_defined? :Session
193
200
 
@@ -217,6 +224,39 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
217
224
  assert_equal 1, @http.ssl_generation
218
225
  end
219
226
 
227
+ def test_can_retry_eh_change_requests
228
+ post = Net::HTTP::Post.new '/'
229
+
230
+ refute @http.can_retry? post
231
+
232
+ @http.retry_change_requests = true
233
+
234
+ assert @http.can_retry? post
235
+ end
236
+
237
+ if RUBY_1 then
238
+ def test_can_retry_eh_idempotent
239
+ head = Net::HTTP::Head.new '/'
240
+
241
+ assert @http.can_retry? head
242
+
243
+ post = Net::HTTP::Post.new '/'
244
+
245
+ refute @http.can_retry? post
246
+ end
247
+ else
248
+ def test_can_retry_eh_idempotent
249
+ head = Net::HTTP::Head.new '/'
250
+
251
+ assert @http.can_retry? head
252
+ refute @http.can_retry? head, true
253
+
254
+ post = Net::HTTP::Post.new '/'
255
+
256
+ refute @http.can_retry? post
257
+ end
258
+ end
259
+
220
260
  def test_cert_store_equals
221
261
  @http.cert_store = :cert_store
222
262
 
@@ -366,6 +406,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
366
406
  end
367
407
 
368
408
  def test_connection_for_finished_ssl
409
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
410
+
369
411
  uri = URI.parse 'https://example.com/path'
370
412
  c = @http.connection_for uri
371
413
 
@@ -526,6 +568,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
526
568
  end
527
569
 
528
570
  def test_connection_for_ssl
571
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
572
+
529
573
  uri = URI.parse 'https://example.com/path'
530
574
  c = @http.connection_for uri
531
575
 
@@ -534,6 +578,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
534
578
  end
535
579
 
536
580
  def test_connection_for_ssl_cached
581
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
582
+
537
583
  @uri = URI.parse 'https://example.com/path'
538
584
 
539
585
  cached = ssl_connection 0
@@ -544,6 +590,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
544
590
  end
545
591
 
546
592
  def test_connection_for_ssl_cached_reconnect
593
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
594
+
547
595
  @uri = URI.parse 'https://example.com/path'
548
596
 
549
597
  cached = ssl_connection
@@ -556,6 +604,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
556
604
  end
557
605
 
558
606
  def test_connection_for_ssl_case
607
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
608
+
559
609
  uri = URI.parse 'HTTPS://example.com/path'
560
610
  c = @http.connection_for uri
561
611
 
@@ -596,6 +646,7 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
596
646
 
597
647
  def test_expired_eh
598
648
  c = basic_connection
649
+ reqs[c.object_id] = 0
599
650
  touts[c.object_id] = Time.now - 11
600
651
 
601
652
  @http.idle_timeout = 0
@@ -614,6 +665,23 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
614
665
  refute @http.expired? c
615
666
  end
616
667
 
668
+ def test_expired_due_to_max_requests
669
+ c = basic_connection
670
+ reqs[c.object_id] = 0
671
+ touts[c.object_id] = Time.now
672
+
673
+ refute @http.expired? c
674
+
675
+ reqs[c.object_id] = 10
676
+ refute @http.expired? c
677
+
678
+ @http.max_requests = 10
679
+ assert @http.expired? c
680
+
681
+ reqs[c.object_id] = 9
682
+ refute @http.expired? c
683
+ end
684
+
617
685
  def test_finish
618
686
  c = basic_connection
619
687
  reqs[c.object_id] = 5
@@ -708,7 +776,7 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
708
776
  end
709
777
 
710
778
  def test_proxy_equals_env
711
- ENV['HTTP_PROXY'] = 'proxy.example'
779
+ ENV['http_proxy'] = 'proxy.example'
712
780
 
713
781
  @http.proxy = :ENV
714
782
 
@@ -727,9 +795,9 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
727
795
  end
728
796
 
729
797
  def test_proxy_from_env
730
- ENV['HTTP_PROXY'] = 'proxy.example'
731
- ENV['HTTP_PROXY_USER'] = 'johndoe'
732
- ENV['HTTP_PROXY_PASS'] = 'muffins'
798
+ ENV['http_proxy'] = 'proxy.example'
799
+ ENV['http_proxy_user'] = 'johndoe'
800
+ ENV['http_proxy_pass'] = 'muffins'
733
801
  ENV['NO_PROXY'] = 'localhost,example.com'
734
802
 
735
803
  uri = @http.proxy_from_env
@@ -763,7 +831,7 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
763
831
 
764
832
  assert_nil uri
765
833
 
766
- ENV['HTTP_PROXY'] = ''
834
+ ENV['http_proxy'] = ''
767
835
 
768
836
  uri = @http.proxy_from_env
769
837
 
@@ -775,8 +843,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
775
843
 
776
844
  assert_nil uri
777
845
 
778
- ENV['HTTP_PROXY'] = 'proxy.example'
779
- ENV['NO_PROXY'] = '*'
846
+ ENV['http_proxy'] = 'proxy.example'
847
+ ENV['no_proxy'] = '*'
780
848
 
781
849
  uri = @http.proxy_from_env
782
850
 
@@ -784,8 +852,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
784
852
  end
785
853
 
786
854
  def test_proxy_bypass
787
- ENV['HTTP_PROXY'] = 'proxy.example'
788
- ENV['NO_PROXY'] = 'localhost,example.com:80'
855
+ ENV['http_proxy'] = 'proxy.example'
856
+ ENV['no_proxy'] = 'localhost,example.com:80'
789
857
 
790
858
  @http.proxy = :ENV
791
859
 
@@ -801,8 +869,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
801
869
  end
802
870
 
803
871
  def test_proxy_bypass_space
804
- ENV['HTTP_PROXY'] = 'proxy.example'
805
- ENV['NO_PROXY'] = 'localhost, example.com'
872
+ ENV['http_proxy'] = 'proxy.example'
873
+ ENV['no_proxy'] = 'localhost, example.com'
806
874
 
807
875
  @http.proxy = :ENV
808
876
 
@@ -811,8 +879,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
811
879
  end
812
880
 
813
881
  def test_proxy_bypass_trailing
814
- ENV['HTTP_PROXY'] = 'proxy.example'
815
- ENV['NO_PROXY'] = 'localhost,example.com,'
882
+ ENV['http_proxy'] = 'proxy.example'
883
+ ENV['no_proxy'] = 'localhost,example.com,'
816
884
 
817
885
  @http.proxy = :ENV
818
886
 
@@ -821,8 +889,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
821
889
  end
822
890
 
823
891
  def test_proxy_bypass_double_comma
824
- ENV['HTTP_PROXY'] = 'proxy.example'
825
- ENV['NO_PROXY'] = 'localhost,,example.com'
892
+ ENV['http_proxy'] = 'proxy.example'
893
+ ENV['no_proxy'] = 'localhost,,example.com'
826
894
 
827
895
  @http.proxy = :ENV
828
896
 
@@ -866,6 +934,18 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
866
934
  assert_equal 1, reqs[c.object_id]
867
935
  end
868
936
 
937
+ def test_request_ETIMEDOUT
938
+ c = basic_connection
939
+ def c.request(*a) raise Errno::ETIMEDOUT, "timed out" end
940
+
941
+ e = assert_raises Net::HTTP::Persistent::Error do
942
+ @http.request @uri
943
+ end
944
+
945
+ assert_equal 0, reqs[c.object_id]
946
+ assert_match %r%too many connection resets%, e.message
947
+ end
948
+
869
949
  def test_request_bad_response
870
950
  c = basic_connection
871
951
  def c.request(*a) raise Net::HTTPBadResponse end
@@ -878,23 +958,38 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
878
958
  assert_match %r%too many bad responses%, e.message
879
959
  end
880
960
 
881
- def test_request_bad_response_retry
882
- c = basic_connection
883
- def c.request(*a)
884
- if defined? @called then
885
- r = Net::HTTPResponse.allocate
886
- r.instance_variable_set :@header, {}
887
- def r.http_version() '1.1' end
888
- r
889
- else
890
- @called = true
891
- raise Net::HTTPBadResponse
961
+ if RUBY_1 then
962
+ def test_request_bad_response_retry
963
+ c = basic_connection
964
+ def c.request(*a)
965
+ if defined? @called then
966
+ r = Net::HTTPResponse.allocate
967
+ r.instance_variable_set :@header, {}
968
+ def r.http_version() '1.1' end
969
+ r
970
+ else
971
+ @called = true
972
+ raise Net::HTTPBadResponse
973
+ end
892
974
  end
975
+
976
+ @http.request @uri
977
+
978
+ assert c.finished?
893
979
  end
980
+ else
981
+ def test_request_bad_response_retry
982
+ c = basic_connection
983
+ def c.request(*a)
984
+ raise Net::HTTPBadResponse
985
+ end
894
986
 
895
- @http.request @uri
987
+ assert_raises Net::HTTP::Persistent::Error do
988
+ @http.request @uri
989
+ end
896
990
 
897
- assert c.finished?
991
+ assert c.finished?
992
+ end
898
993
  end
899
994
 
900
995
  def test_request_bad_response_unsafe
@@ -1023,6 +1118,18 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1023
1118
  assert c.finished?
1024
1119
  end
1025
1120
 
1121
+ def test_request_exception
1122
+ c = basic_connection
1123
+ def c.request(*a) raise Exception, "very bad things happened" end
1124
+
1125
+ assert_raises Exception do
1126
+ @http.request @uri
1127
+ end
1128
+
1129
+ assert_equal 0, reqs[c.object_id]
1130
+ assert c.finished?
1131
+ end
1132
+
1026
1133
  def test_request_invalid
1027
1134
  c = basic_connection
1028
1135
  def c.request(*a) raise Errno::EINVAL, "write" end
@@ -1080,25 +1187,43 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1080
1187
  assert_match %r%too many connection resets%, e.message
1081
1188
  end
1082
1189
 
1083
- def test_request_reset_retry
1084
- c = basic_connection
1085
- touts[c.object_id] = Time.now
1086
- def c.request(*a)
1087
- if defined? @called then
1088
- r = Net::HTTPResponse.allocate
1089
- r.instance_variable_set :@header, {}
1090
- def r.http_version() '1.1' end
1091
- r
1092
- else
1093
- @called = true
1094
- raise Errno::ECONNRESET
1190
+ if RUBY_1 then
1191
+ def test_request_reset_retry
1192
+ c = basic_connection
1193
+ touts[c.object_id] = Time.now
1194
+ def c.request(*a)
1195
+ if defined? @called then
1196
+ r = Net::HTTPResponse.allocate
1197
+ r.instance_variable_set :@header, {}
1198
+ def r.http_version() '1.1' end
1199
+ r
1200
+ else
1201
+ @called = true
1202
+ raise Errno::ECONNRESET
1203
+ end
1095
1204
  end
1205
+
1206
+ @http.request @uri
1207
+
1208
+ assert c.reset?
1209
+ assert c.finished?
1096
1210
  end
1211
+ else
1212
+ def test_request_reset_retry
1213
+ c = basic_connection
1214
+ touts[c.object_id] = Time.now
1097
1215
 
1098
- @http.request @uri
1216
+ def c.request(*a)
1217
+ raise Errno::ECONNRESET
1218
+ end
1099
1219
 
1100
- assert c.reset?
1101
- assert c.finished?
1220
+ assert_raises Net::HTTP::Persistent::Error do
1221
+ @http.request @uri
1222
+ end
1223
+
1224
+ refute c.reset?
1225
+ assert c.finished?
1226
+ end
1102
1227
  end
1103
1228
 
1104
1229
  def test_request_reset_unsafe
@@ -1121,6 +1246,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1121
1246
  end
1122
1247
 
1123
1248
  def test_request_ssl_error
1249
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1250
+
1124
1251
  uri = URI.parse 'https://example.com/path'
1125
1252
  c = @http.connection_for uri
1126
1253
  def c.request(*)
@@ -1133,6 +1260,57 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1133
1260
  assert_match %r%bad write retry%, e.message
1134
1261
  end
1135
1262
 
1263
+ def test_request_setup
1264
+ @http.override_headers['user-agent'] = 'test ua'
1265
+ @http.headers['accept'] = 'text/*'
1266
+
1267
+ input = Net::HTTP::Post.new '/path'
1268
+
1269
+ req = @http.request_setup input
1270
+
1271
+ assert_same input, req
1272
+ assert_equal '/path', req.path
1273
+
1274
+ assert_equal 'test ua', req['user-agent']
1275
+ assert_match %r%text/\*%, req['accept']
1276
+
1277
+ assert_equal 'keep-alive', req['connection']
1278
+ assert_equal '30', req['keep-alive']
1279
+ end
1280
+
1281
+ def test_request_setup_uri
1282
+ uri = @uri + '?a=b'
1283
+
1284
+ req = @http.request_setup uri
1285
+
1286
+ assert_kind_of Net::HTTP::Get, req
1287
+ assert_equal '/path?a=b', req.path
1288
+ end
1289
+
1290
+ def test_request_failed
1291
+ c = basic_connection
1292
+ reqs[c.object_id] = 1
1293
+ touts[c.object_id] = Time.now
1294
+
1295
+ original = nil
1296
+
1297
+ begin
1298
+ raise 'original'
1299
+ rescue => original
1300
+ end
1301
+
1302
+ req = Net::HTTP::Get.new '/'
1303
+
1304
+ e = assert_raises Net::HTTP::Persistent::Error do
1305
+ @http.request_failed original, req, c
1306
+ end
1307
+
1308
+ assert_match "too many connection resets (due to original - RuntimeError)",
1309
+ e.message
1310
+
1311
+ assert_equal original.backtrace, e.backtrace
1312
+ end
1313
+
1136
1314
  def test_reset
1137
1315
  c = basic_connection
1138
1316
  c.start
@@ -1191,14 +1369,25 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1191
1369
 
1192
1370
  refute @http.retry_change_requests
1193
1371
 
1194
- assert @http.can_retry?(get)
1372
+ if RUBY_1 then
1373
+ assert @http.can_retry?(get)
1374
+ else
1375
+ assert @http.can_retry?(get)
1376
+ end
1377
+ refute @http.can_retry?(get, true)
1195
1378
  refute @http.can_retry?(post)
1196
1379
 
1197
1380
  @http.retry_change_requests = true
1198
1381
 
1199
1382
  assert @http.retry_change_requests
1200
1383
 
1201
- assert @http.can_retry?(get)
1384
+ if RUBY_1 then
1385
+ assert @http.can_retry?(get)
1386
+ else
1387
+ assert @http.can_retry?(get)
1388
+ refute @http.can_retry?(get, true)
1389
+ end
1390
+
1202
1391
  assert @http.can_retry?(post)
1203
1392
  end
1204
1393
 
@@ -1292,6 +1481,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1292
1481
  end
1293
1482
 
1294
1483
  def test_shutdown_ssl
1484
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1485
+
1295
1486
  @uri = URI 'https://example'
1296
1487
 
1297
1488
  @http.connection_for @uri
@@ -1331,6 +1522,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1331
1522
  end
1332
1523
 
1333
1524
  def test_ssl
1525
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1526
+
1334
1527
  @http.verify_callback = :callback
1335
1528
  c = Net::HTTP.new 'localhost', 80
1336
1529
 
@@ -1343,6 +1536,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1343
1536
  end
1344
1537
 
1345
1538
  def test_ssl_ca_file
1539
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1540
+
1346
1541
  @http.ca_file = 'ca_file'
1347
1542
  @http.verify_callback = :callback
1348
1543
  c = Net::HTTP.new 'localhost', 80
@@ -1355,6 +1550,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1355
1550
  end
1356
1551
 
1357
1552
  def test_ssl_cert_store
1553
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1554
+
1358
1555
  store = OpenSSL::X509::Store.new
1359
1556
  @http.cert_store = store
1360
1557
 
@@ -1367,6 +1564,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1367
1564
  end
1368
1565
 
1369
1566
  def test_ssl_cert_store_default
1567
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1568
+
1370
1569
  @http.verify_mode = OpenSSL::SSL::VERIFY_PEER
1371
1570
 
1372
1571
  c = Net::HTTP.new 'localhost', 80
@@ -1378,6 +1577,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1378
1577
  end
1379
1578
 
1380
1579
  def test_ssl_certificate
1580
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1581
+
1381
1582
  @http.certificate = :cert
1382
1583
  @http.private_key = :key
1383
1584
  c = Net::HTTP.new 'localhost', 80
@@ -1390,6 +1591,8 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1390
1591
  end
1391
1592
 
1392
1593
  def test_ssl_verify_mode
1594
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1595
+
1393
1596
  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
1394
1597
  c = Net::HTTP.new 'localhost', 80
1395
1598
 
@@ -1400,35 +1603,41 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1400
1603
  end
1401
1604
 
1402
1605
  def test_ssl_warning
1403
- orig_verify_peer = OpenSSL::SSL::VERIFY_PEER
1404
- OpenSSL::SSL.send :remove_const, :VERIFY_PEER
1405
- OpenSSL::SSL.send :const_set, :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE
1606
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1406
1607
 
1407
- c = Net::HTTP.new 'localhost', 80
1608
+ begin
1609
+ orig_verify_peer = OpenSSL::SSL::VERIFY_PEER
1610
+ OpenSSL::SSL.send :remove_const, :VERIFY_PEER
1611
+ OpenSSL::SSL.send :const_set, :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE
1408
1612
 
1409
- out, err = capture_io do
1410
- @http.ssl c
1411
- end
1613
+ c = Net::HTTP.new 'localhost', 80
1412
1614
 
1413
- assert_empty out
1615
+ out, err = capture_io do
1616
+ @http.ssl c
1617
+ end
1414
1618
 
1415
- assert_match %r%localhost:80%, err
1416
- assert_match %r%I_KNOW_THAT_OPENSSL%, err
1619
+ assert_empty out
1417
1620
 
1418
- Object.send :const_set, :I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG, nil
1621
+ assert_match %r%localhost:80%, err
1622
+ assert_match %r%I_KNOW_THAT_OPENSSL%, err
1419
1623
 
1420
- assert_silent do
1421
- @http.ssl c
1422
- end
1423
- ensure
1424
- OpenSSL::SSL.send :remove_const, :VERIFY_PEER
1425
- OpenSSL::SSL.send :const_set, :VERIFY_PEER, orig_verify_peer
1426
- if Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then
1427
- Object.send :remove_const, :I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG
1624
+ Object.send :const_set, :I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG, nil
1625
+
1626
+ assert_silent do
1627
+ @http.ssl c
1628
+ end
1629
+ ensure
1630
+ OpenSSL::SSL.send :remove_const, :VERIFY_PEER
1631
+ OpenSSL::SSL.send :const_set, :VERIFY_PEER, orig_verify_peer
1632
+ if Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then
1633
+ Object.send :remove_const, :I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG
1634
+ end
1428
1635
  end
1429
1636
  end
1430
1637
 
1431
1638
  def test_ssl_cleanup
1639
+ skip 'OpenSSL is missing' unless HAVE_OPENSSL
1640
+
1432
1641
  uri1 = URI.parse 'https://one.example'
1433
1642
 
1434
1643
  c1 = @http.connection_for uri1
@@ -1450,7 +1659,7 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
1450
1659
 
1451
1660
  assert_equal :ssl_version, @http.ssl_version
1452
1661
  assert_equal 1, @http.ssl_generation
1453
- end if RUBY_VERSION > '1.9'
1662
+ end unless RUBY_1
1454
1663
 
1455
1664
  def test_start
1456
1665
  c = basic_connection
@@ -1,15 +1,21 @@
1
1
  require 'rubygems'
2
2
  require 'minitest/autorun'
3
3
  require 'net/http/persistent'
4
- require 'openssl'
5
- require 'webrick'
6
- require 'webrick/ssl'
4
+ have_ssl =
5
+ begin
6
+ require 'openssl'
7
+ require 'webrick'
8
+ require 'webrick/ssl'
9
+ true
10
+ rescue LoadError
11
+ false
12
+ end
7
13
 
8
14
  ##
9
15
  # This test is based on (and contains verbatim code from) the Net::HTTP tests
10
16
  # in ruby
11
17
 
12
- class TestNetHttpPersistentSSLReuse < MiniTest::Unit::TestCase
18
+ class TestNetHttpPersistentSSLReuse < Minitest::Test
13
19
 
14
20
  class NullWriter
15
21
  def <<(s) end
@@ -102,5 +108,5 @@ class TestNetHttpPersistentSSLReuse < MiniTest::Unit::TestCase
102
108
  assert ssl_socket.session_reused?
103
109
  end
104
110
 
105
- end
111
+ end if have_ssl
106
112
 
metadata CHANGED
@@ -1,112 +1,90 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-http-persistent
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.8'
5
- prerelease:
4
+ version: '2.9'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric Hodel
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURlRENDQW1DZ0F3SUJB
14
- Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJCTVJBd0RnWURWUVFEREFka2Nt
15
- SnkKWVdsdU1SZ3dGZ1lLQ1pJbWlaUHlMR1FCR1JZSWMyVm5iV1Z1ZERjeEV6
16
- QVJCZ29Ka2lhSmsvSXNaQUVaRmdOdQpaWFF3SGhjTk1USXdNakk0TVRjMU5E
17
- STFXaGNOTVRNd01qSTNNVGMxTkRJMVdqQkJNUkF3RGdZRFZRUUREQWRrCmNt
18
- SnlZV2x1TVJnd0ZnWUtDWkltaVpQeUxHUUJHUllJYzJWbmJXVnVkRGN4RXpB
19
- UkJnb0praWFKay9Jc1pBRVoKRmdOdVpYUXdnZ0VpTUEwR0NTcUdTSWIzRFFF
20
- QkFRVUFBNElCRHdBd2dnRUtBb0lCQVFDYmJnTHJHTEdJREU3NgpMVi9jdnhk
21
- RXpDdVl1UzNvRzlQclNabnVEd2V5U1VmZHAvc28wY0RxK2o4YnF5Nk96WlN3
22
- MDdnZGp3Rk1TZDZKClU1ZGRaQ1Z5d241bm5BUStVaTdqTVc1NENZdDUvSDZm
23
- MlVTNlUwaFFPakpSNmNwZml5bWd4R2RmeVRpVmN2VG0KR2ovb2tXclFsME5q
24
- WU9ZQnBEaSs5UFBtYUgyUm1MSnUwZEIvTnlsc0RuVzVqNnlOMUJFSThNZkpS
25
- UitIUktaWQptVXRnekJ3RjFWNEtJWlE4RXVMNkkvbkhWdTA3aTZJa3JwQWd4
26
- cFhVZmRKUUppMG9aQXFYdXJBVjN5VHhrRndkCmc2MllyclcyNm1EZStwWkJ6
27
- UjZicExFK1BtWEN6ejdVeFVxM0FFMGdQSGJpTVhpZTNFRkUwb3huc1UzbElk
28
- dWgKc0NBTmlROEJBZ01CQUFHamV6QjVNQWtHQTFVZEV3UUNNQUF3Q3dZRFZS
29
- MFBCQVFEQWdTd01CMEdBMVVkRGdRVwpCQlM1azRaNzVWU3BkTTBBY2xHMlV2
30
- ekZBL1ZXNURBZkJnTlZIUkVFR0RBV2dSUmtjbUp5WVdsdVFITmxaMjFsCmJu
31
- UTNMbTVsZERBZkJnTlZIUklFR0RBV2dSUmtjbUp5WVdsdVFITmxaMjFsYm5R
32
- M0xtNWxkREFOQmdrcWhraUcKOXcwQkFRVUZBQU9DQVFFQVBlV3pGbnJjdkM2
33
- ZVZ6ZGxobWpVdWIyczZxaWVCa29uZ0tSREhRejVNRWVRdjRMUwpTQVJub0hZ
34
- K3VDQVZMLzF4R0FobXB6cVEzZkpHV0s5ZUJhY1cvZThFNUdGOXhRY1YzbUUx
35
- YkEwV05haURsWDVqClUyYUkrWkdTYmxxdkhVQ3hLQkhSMXM3VU1Ic2J6MXNh
36
- T21nZFJUeVB4MGp1SnM2OG9jYlVUZVlCTFd1OVY0S1AKemRHQUcySlhPMmdP
37
- TmczYjR0WUR2cEJMYnJ5K0tPWDI3aUFKdWxVYUg5VGlUT1VMTDRJVEpWRnNL
38
- MG1ZVnFtUgpROFRubzlTM2U0WEdHUDFaV2ZMclRXRUpiYXZGZmhHSHV0MmlN
39
- UndmQzdzL1lJTEFITkFUb3BhSmRIOUROcGQxClU4MXpHSE1VQk92ei9WR1Q2
40
- d0p3WUozZW1TMm5mQTJOT0hGZmdBPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUt
41
- LS0tLQo=
42
- date: 2012-10-18 00:00:00.000000000 Z
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
14
+ YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
15
+ ZXQwHhcNMTMwMjI4MDUyMjA4WhcNMTQwMjI4MDUyMjA4WjBBMRAwDgYDVQQDDAdk
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
+ sCANiQ8BAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
+ BBS5k4Z75VSpdM0AclG2UvzFA/VW5DAfBgNVHREEGDAWgRRkcmJyYWluQHNlZ21l
25
+ bnQ3Lm5ldDAfBgNVHRIEGDAWgRRkcmJyYWluQHNlZ21lbnQ3Lm5ldDANBgkqhkiG
26
+ 9w0BAQUFAAOCAQEAOflo4Md5aJF//EetzXIGZ2EI5PzKWX/mMpp7cxFyDcVPtTv0
27
+ js/6zWrWSbd60W9Kn4ch3nYiATFKhisgeYotDDz2/pb/x1ivJn4vEvs9kYKVvbF8
28
+ V7MV/O5HDW8Q0pA1SljI6GzcOgejtUMxZCyyyDdbUpyAMdt9UpqTZkZ5z1sicgQk
29
+ 5o2XJ+OhceOIUVqVh1r6DNY5tLVaGJabtBmJAYFVznDcHiSFybGKBa5n25Egql1t
30
+ KDyY1VIazVgoC8XvR4h/95/iScPiuglzA+DBG1hip1xScAtw05BrXyUNrc9CEMYU
31
+ wgF94UVoHRp6ywo8I7NP3HcwFQDFNEZPNGXsng==
32
+ -----END CERTIFICATE-----
33
+ date: 2013-07-24 00:00:00.000000000 Z
43
34
  dependencies:
44
35
  - !ruby/object:Gem::Dependency
45
36
  name: minitest
46
37
  requirement: !ruby/object:Gem::Requirement
47
- none: false
48
38
  requirements:
49
39
  - - ~>
50
40
  - !ruby/object:Gem::Version
51
- version: '3.4'
41
+ version: '5.0'
52
42
  type: :development
53
43
  prerelease: false
54
44
  version_requirements: !ruby/object:Gem::Requirement
55
- none: false
56
45
  requirements:
57
46
  - - ~>
58
47
  - !ruby/object:Gem::Version
59
- version: '3.4'
48
+ version: '5.0'
60
49
  - !ruby/object:Gem::Dependency
61
50
  name: rdoc
62
51
  requirement: !ruby/object:Gem::Requirement
63
- none: false
64
52
  requirements:
65
53
  - - ~>
66
54
  - !ruby/object:Gem::Version
67
- version: '3.10'
55
+ version: '4.0'
68
56
  type: :development
69
57
  prerelease: false
70
58
  version_requirements: !ruby/object:Gem::Requirement
71
- none: false
72
59
  requirements:
73
60
  - - ~>
74
61
  - !ruby/object:Gem::Version
75
- version: '3.10'
62
+ version: '4.0'
76
63
  - !ruby/object:Gem::Dependency
77
64
  name: hoe
78
65
  requirement: !ruby/object:Gem::Requirement
79
- none: false
80
66
  requirements:
81
67
  - - ~>
82
68
  - !ruby/object:Gem::Version
83
- version: '3.0'
69
+ version: '3.6'
84
70
  type: :development
85
71
  prerelease: false
86
72
  version_requirements: !ruby/object:Gem::Requirement
87
- none: false
88
73
  requirements:
89
74
  - - ~>
90
75
  - !ruby/object:Gem::Version
91
- version: '3.0'
92
- description: ! 'Manages persistent connections using Net::HTTP plus a speed fix for
93
- Ruby 1.8.
94
-
95
- It''s thread-safe too!
96
-
76
+ version: '3.6'
77
+ description: |-
78
+ Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8.
79
+ It's thread-safe too!
97
80
 
98
81
  Using persistent HTTP connections can dramatically increase the speed of HTTP.
99
-
100
82
  Creating a new HTTP connection for every request involves an extra TCP
101
-
102
83
  round-trip and causes TCP congestion avoidance negotiation to start over.
103
84
 
104
-
105
85
  Net::HTTP supports persistent connections with some API methods but does not
106
-
107
86
  handle reconnection gracefully. Net::HTTP::Persistent supports reconnection
108
-
109
- and retry according to RFC 2616.'
87
+ and retry according to RFC 2616.
110
88
  email:
111
89
  - drbrain@segment7.net
112
90
  executables: []
@@ -129,6 +107,7 @@ files:
129
107
  - test/test_net_http_persistent_ssl_reuse.rb
130
108
  homepage: http://docs.seattlerb.org/net-http-persistent
131
109
  licenses: []
110
+ metadata: {}
132
111
  post_install_message:
133
112
  rdoc_options:
134
113
  - --main
@@ -136,22 +115,20 @@ rdoc_options:
136
115
  require_paths:
137
116
  - lib
138
117
  required_ruby_version: !ruby/object:Gem::Requirement
139
- none: false
140
118
  requirements:
141
- - - ! '>='
119
+ - - '>='
142
120
  - !ruby/object:Gem::Version
143
121
  version: '0'
144
122
  required_rubygems_version: !ruby/object:Gem::Requirement
145
- none: false
146
123
  requirements:
147
- - - ! '>='
124
+ - - '>='
148
125
  - !ruby/object:Gem::Version
149
126
  version: '0'
150
127
  requirements: []
151
128
  rubyforge_project: net-http-persistent
152
- rubygems_version: 1.8.24
129
+ rubygems_version: 2.0.4
153
130
  signing_key:
154
- specification_version: 3
131
+ specification_version: 4
155
132
  summary: Manages persistent connections using Net::HTTP plus a speed fix for Ruby
156
133
  1.8
157
134
  test_files:
metadata.gz.sig CHANGED
Binary file