excon 0.64.0 → 0.65.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of excon might be problematic. Click here for more details.

Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/data/cacert.pem +108 -2
  3. data/excon.gemspec +7 -2
  4. data/lib/excon.rb +11 -11
  5. data/lib/excon/connection.rb +25 -25
  6. data/lib/excon/response.rb +1 -1
  7. data/lib/excon/version.rb +1 -1
  8. metadata +3 -101
  9. data/.document +0 -5
  10. data/.github/stale.yml +0 -17
  11. data/.gitignore +0 -13
  12. data/.rspec +0 -3
  13. data/.travis.yml +0 -17
  14. data/Gemfile +0 -19
  15. data/Rakefile +0 -41
  16. data/benchmarks/class_vs_lambda.rb +0 -50
  17. data/benchmarks/concat_vs_insert.rb +0 -21
  18. data/benchmarks/concat_vs_interpolate.rb +0 -22
  19. data/benchmarks/cr_lf.rb +0 -21
  20. data/benchmarks/downcase-eq-eq_vs_casecmp.rb +0 -169
  21. data/benchmarks/excon.rb +0 -69
  22. data/benchmarks/excon_vs.rb +0 -165
  23. data/benchmarks/for_vs_array_each.rb +0 -27
  24. data/benchmarks/for_vs_hash_each.rb +0 -27
  25. data/benchmarks/has_key-vs-lookup.rb +0 -177
  26. data/benchmarks/headers_case_sensitivity.rb +0 -83
  27. data/benchmarks/headers_split_vs_match.rb +0 -34
  28. data/benchmarks/implicit_block-vs-explicit_block.rb +0 -98
  29. data/benchmarks/merging.rb +0 -21
  30. data/benchmarks/single_vs_double_quotes.rb +0 -21
  31. data/benchmarks/string_ranged_index.rb +0 -87
  32. data/benchmarks/strip_newline.rb +0 -115
  33. data/benchmarks/vs_stdlib.rb +0 -82
  34. data/changelog.txt +0 -1113
  35. data/spec/excon/error_spec.rb +0 -139
  36. data/spec/excon/test/server_spec.rb +0 -28
  37. data/spec/excon_spec.rb +0 -7
  38. data/spec/helpers/file_path_helpers.rb +0 -22
  39. data/spec/helpers/warning_helpers.rb +0 -9
  40. data/spec/requests/basic_spec.rb +0 -40
  41. data/spec/requests/eof_requests_spec.rb +0 -36
  42. data/spec/requests/unix_socket_spec.rb +0 -38
  43. data/spec/requests/validation_spec.rb +0 -80
  44. data/spec/spec_helper.rb +0 -26
  45. data/spec/support/shared_contexts/test_server_context.rb +0 -83
  46. data/spec/support/shared_contexts/test_stub_context.rb +0 -11
  47. data/spec/support/shared_examples/shared_example_for_clients.rb +0 -220
  48. data/spec/support/shared_examples/shared_example_for_streaming_clients.rb +0 -20
  49. data/spec/support/shared_examples/shared_example_for_test_servers.rb +0 -16
  50. data/tests/authorization_header_tests.rb +0 -27
  51. data/tests/bad_tests.rb +0 -69
  52. data/tests/basic_tests.rb +0 -351
  53. data/tests/batch_requests.rb +0 -133
  54. data/tests/complete_responses.rb +0 -31
  55. data/tests/data/127.0.0.1.cert.crt +0 -17
  56. data/tests/data/127.0.0.1.cert.key +0 -28
  57. data/tests/data/excon.cert.crt +0 -17
  58. data/tests/data/excon.cert.key +0 -28
  59. data/tests/data/xs +0 -1
  60. data/tests/error_tests.rb +0 -145
  61. data/tests/header_tests.rb +0 -119
  62. data/tests/instrumentors/logging_instrumentor_tests.rb +0 -28
  63. data/tests/middleware_tests.rb +0 -27
  64. data/tests/middlewares/canned_response_tests.rb +0 -34
  65. data/tests/middlewares/capture_cookies_tests.rb +0 -34
  66. data/tests/middlewares/decompress_tests.rb +0 -157
  67. data/tests/middlewares/escape_path_tests.rb +0 -36
  68. data/tests/middlewares/idempotent_tests.rb +0 -245
  69. data/tests/middlewares/instrumentation_tests.rb +0 -315
  70. data/tests/middlewares/mock_tests.rb +0 -304
  71. data/tests/middlewares/redirect_follower_tests.rb +0 -112
  72. data/tests/pipeline_tests.rb +0 -40
  73. data/tests/proxy_tests.rb +0 -306
  74. data/tests/query_string_tests.rb +0 -87
  75. data/tests/rackups/basic.rb +0 -41
  76. data/tests/rackups/basic.ru +0 -3
  77. data/tests/rackups/basic_auth.ru +0 -14
  78. data/tests/rackups/deflater.ru +0 -4
  79. data/tests/rackups/proxy.ru +0 -18
  80. data/tests/rackups/query_string.ru +0 -13
  81. data/tests/rackups/redirecting.ru +0 -23
  82. data/tests/rackups/redirecting_with_cookie.ru +0 -40
  83. data/tests/rackups/request_headers.ru +0 -15
  84. data/tests/rackups/request_methods.ru +0 -21
  85. data/tests/rackups/response_header.ru +0 -18
  86. data/tests/rackups/ssl.ru +0 -16
  87. data/tests/rackups/ssl_mismatched_cn.ru +0 -15
  88. data/tests/rackups/ssl_verify_peer.ru +0 -16
  89. data/tests/rackups/streaming.ru +0 -30
  90. data/tests/rackups/thread_safety.ru +0 -17
  91. data/tests/rackups/timeout.ru +0 -14
  92. data/tests/rackups/webrick_patch.rb +0 -34
  93. data/tests/request_headers_tests.rb +0 -21
  94. data/tests/request_method_tests.rb +0 -47
  95. data/tests/request_tests.rb +0 -58
  96. data/tests/response_tests.rb +0 -197
  97. data/tests/servers/bad.rb +0 -25
  98. data/tests/servers/eof.rb +0 -17
  99. data/tests/servers/error.rb +0 -20
  100. data/tests/servers/good.rb +0 -342
  101. data/tests/servers/good_ipv4.rb +0 -8
  102. data/tests/servers/good_ipv6.rb +0 -8
  103. data/tests/test_helper.rb +0 -297
  104. data/tests/thread_safety_tests.rb +0 -39
  105. data/tests/timeout_tests.rb +0 -12
  106. data/tests/utils_tests.rb +0 -81
@@ -1,34 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- data = "Content-Length: 100"
5
- Tach.meter(1_000_000) do
6
- tach('regex') do
7
- data.match(/(.*):\s(.*)/)
8
- header = [$1, $2]
9
- end
10
- tach('split') do
11
- header = data.split(': ', 2)
12
- end
13
- tach('split regex') do
14
- header = data.split(/:\s*/, 2)
15
- end
16
- end
17
-
18
- # +-------------+----------+
19
- # | tach | total |
20
- # +-------------+----------+
21
- # | split regex | 5.940233 |
22
- # +-------------+----------+
23
- # | split | 7.327549 |
24
- # +-------------+----------+
25
- # | regex | 8.736390 |
26
- # +-------------+----------+
27
-
28
- # +-------+----------+----------+
29
- # | tach | average | total |
30
- # +-------+----------+----------+
31
- # | regex | 4.680451 | 4.680451 |
32
- # +-------+----------+----------+
33
- # | split | 4.393218 | 4.393218 |
34
- # +-------+----------+----------+
@@ -1,98 +0,0 @@
1
- # Copied from my benchmark_hell repo: github.com/sgonyea/benchmark_hell
2
-
3
- require 'benchmark'
4
-
5
- iters = 1000000
6
-
7
- def do_explicit(&block)
8
- var = "hello"
9
- block.call(var)
10
- end
11
-
12
- def do_implicit
13
- var = "hello"
14
- yield(var)
15
- end
16
-
17
- puts 'explicit block vs implicit'
18
- Benchmark.bmbm do |x|
19
- x.report('explicit') do
20
- iters.times.each do
21
- do_explicit {|var|
22
- var << "goodbye"
23
- }
24
- end
25
- end
26
-
27
- x.report('implicit') do
28
- iters.times.each do
29
- do_implicit {|var|
30
- var << "goodbye"
31
- }
32
- end
33
- end
34
- end
35
-
36
- =begin
37
- rvm exec bash -c 'echo && echo $RUBY_VERSION && echo && ruby implicit_block-vs-explicit_block.rb'
38
-
39
- jruby-1.5.6
40
-
41
- explicit block vs implicit
42
- Rehearsal --------------------------------------------
43
- explicit 1.163000 0.000000 1.163000 ( 1.106000)
44
- implicit 0.499000 0.000000 0.499000 ( 0.499000)
45
- ----------------------------------- total: 1.662000sec
46
-
47
- user system total real
48
- explicit 0.730000 0.000000 0.730000 ( 0.730000)
49
- implicit 0.453000 0.000000 0.453000 ( 0.453000)
50
-
51
- macruby-0.7.1
52
-
53
- explicit block vs implicit
54
- Rehearsal --------------------------------------------
55
- explicit 5.070000 0.130000 5.200000 ( 3.546388)
56
- implicit 3.140000 0.050000 3.190000 ( 2.255986)
57
- ----------------------------------- total: 8.390000sec
58
-
59
- user system total real
60
- explicit 5.340000 0.140000 5.480000 ( 3.774963)
61
- implicit 3.170000 0.060000 3.230000 ( 2.279951)
62
-
63
- rbx-head
64
-
65
- explicit block vs implicit
66
- Rehearsal --------------------------------------------
67
- explicit 1.270136 0.006507 1.276643 ( 1.181588)
68
- implicit 0.839831 0.002203 0.842034 ( 0.820849)
69
- ----------------------------------- total: 2.118677sec
70
-
71
- user system total real
72
- explicit 0.960593 0.001526 0.962119 ( 0.966404)
73
- implicit 0.700361 0.001126 0.701487 ( 0.703591)
74
-
75
- ruby-1.8.7-p330
76
-
77
- explicit block vs implicit
78
- Rehearsal --------------------------------------------
79
- explicit 3.970000 0.000000 3.970000 ( 3.985157)
80
- implicit 1.560000 0.000000 1.560000 ( 1.567599)
81
- ----------------------------------- total: 5.530000sec
82
-
83
- user system total real
84
- explicit 3.990000 0.010000 4.000000 ( 4.002637)
85
- implicit 1.560000 0.000000 1.560000 ( 1.560901)
86
-
87
- ruby-1.9.2-p136
88
-
89
- explicit block vs implicit
90
- Rehearsal --------------------------------------------
91
- explicit 2.620000 0.010000 2.630000 ( 2.633762)
92
- implicit 1.080000 0.000000 1.080000 ( 1.076809)
93
- ----------------------------------- total: 3.710000sec
94
-
95
- user system total real
96
- explicit 2.630000 0.010000 2.640000 ( 2.637658)
97
- implicit 1.070000 0.000000 1.070000 ( 1.073589)
98
- =end
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- Tach.meter(10_000) do
5
-
6
- tach('merge') do
7
- default = { :a => 1, :b => 2 }
8
- override = { :b => 3, :c => 4 }
9
- override = default.merge(override)
10
- end
11
-
12
- tach('loop') do
13
- default = { :a => 1, :b => 2 }
14
- override = { :b => 3, :c => 4 }
15
- for key, value in default
16
- override[key] ||= default[key]
17
- end
18
- override
19
- end
20
-
21
- end
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- Tach.meter(1_000_000) do
5
- tach('double') do
6
- "path"
7
- end
8
- tach('single') do
9
- 'path'
10
- end
11
- end
12
-
13
- # [double, single]
14
- #
15
- # +--------+----------+
16
- # | tach | total |
17
- # +--------+----------+
18
- # | single | 0.416340 |
19
- # +--------+----------+
20
- # | double | 0.416570 |
21
- # +--------+----------+
@@ -1,87 +0,0 @@
1
- # Copied from my benchmark_hell repo: github.com/sgonyea/benchmark_hell
2
-
3
- require 'benchmark'
4
-
5
- iters = 1000000
6
-
7
- string = "Test String OMG"
8
-
9
- puts 'String ranged index vs. "coordinates"'
10
- Benchmark.bmbm do |x|
11
- x.report('ranged index') do
12
- iters.times.each do
13
- text = string[2..9]
14
- end
15
- end
16
-
17
- x.report('coordinates') do
18
- iters.times.each do
19
- text = string[2, 9]
20
- end
21
- end
22
- end
23
-
24
- =begin
25
- rvm exec bash -c 'echo && echo $RUBY_VERSION && echo && ruby string_ranged_index.rb'
26
-
27
-
28
- jruby-1.5.6
29
-
30
- String ranged index vs. "coordinates"
31
- Rehearsal ------------------------------------------------
32
- ranged index 0.419000 0.000000 0.419000 ( 0.372000)
33
- coordinates 0.167000 0.000000 0.167000 ( 0.167000)
34
- --------------------------------------- total: 0.586000sec
35
-
36
- user system total real
37
- ranged index 0.158000 0.000000 0.158000 ( 0.159000)
38
- coordinates 0.125000 0.000000 0.125000 ( 0.125000)
39
-
40
- macruby-0.7.1
41
-
42
- String ranged index vs. "coordinates"
43
- Rehearsal ------------------------------------------------
44
- ranged index 1.490000 0.030000 1.520000 ( 1.061326)
45
- coordinates 1.410000 0.030000 1.440000 ( 0.973640)
46
- --------------------------------------- total: 2.960000sec
47
-
48
- user system total real
49
- ranged index 1.520000 0.030000 1.550000 ( 1.081424)
50
- coordinates 1.480000 0.030000 1.510000 ( 1.029214)
51
-
52
- rbx-head
53
-
54
- String ranged index vs. "coordinates"
55
- Rehearsal ------------------------------------------------
56
- ranged index 1.333304 0.009398 1.342702 ( 1.229629)
57
- coordinates 0.306087 0.000603 0.306690 ( 0.303538)
58
- --------------------------------------- total: 1.649392sec
59
-
60
- user system total real
61
- ranged index 0.923626 0.001597 0.925223 ( 0.927411)
62
- coordinates 0.298910 0.000533 0.299443 ( 0.300255)
63
-
64
- ruby-1.8.7-p330
65
-
66
- String ranged index vs. "coordinates"
67
- Rehearsal ------------------------------------------------
68
- ranged index 0.730000 0.000000 0.730000 ( 0.738612)
69
- coordinates 0.660000 0.000000 0.660000 ( 0.660689)
70
- --------------------------------------- total: 1.390000sec
71
-
72
- user system total real
73
- ranged index 0.750000 0.000000 0.750000 ( 0.746172)
74
- coordinates 0.640000 0.000000 0.640000 ( 0.640687)
75
-
76
- ruby-1.9.2-p136
77
-
78
- String ranged index vs. "coordinates"
79
- Rehearsal ------------------------------------------------
80
- ranged index 0.670000 0.000000 0.670000 ( 0.679046)
81
- coordinates 0.620000 0.000000 0.620000 ( 0.622257)
82
- --------------------------------------- total: 1.290000sec
83
-
84
- user system total real
85
- ranged index 0.680000 0.000000 0.680000 ( 0.686510)
86
- coordinates 0.620000 0.000000 0.620000 ( 0.624269)
87
- =end
@@ -1,115 +0,0 @@
1
- # require 'benchmark'
2
- #
3
- # COUNT = 1_000_000
4
- # data = "Content-Length: 100\r\n"
5
- # Benchmark.bmbm(25) do |bench|
6
- # bench.report('chomp') do
7
- # COUNT.times do
8
- # data = "Content-Length: 100\r\n"
9
- # data.chomp
10
- # end
11
- # end
12
- # bench.report('chomp!') do
13
- # COUNT.times do
14
- # data = "Content-Length: 100\r\n"
15
- # data.chomp!
16
- # end
17
- # end
18
- # bench.report('chop') do
19
- # COUNT.times do
20
- # data = "Content-Length: 100\r\n"
21
- # data.chop
22
- # end
23
- # end
24
- # bench.report('chop!') do
25
- # COUNT.times do
26
- # data = "Content-Length: 100\r\n"
27
- # data.chop!
28
- # end
29
- # end
30
- # bench.report('strip') do
31
- # COUNT.times do
32
- # data = "Content-Length: 100\r\n"
33
- # data.strip
34
- # end
35
- # end
36
- # bench.report('strip!') do
37
- # COUNT.times do
38
- # data = "Content-Length: 100\r\n"
39
- # data.strip!
40
- # end
41
- # end
42
- # bench.report('index') do
43
- # COUNT.times do
44
- # data = "Content-Length: 100\r\n"
45
- # data[0..-3]
46
- # end
47
- # end
48
- # end
49
-
50
-
51
-
52
- # Rehearsal ------------------------------------------------------------
53
- # chomp 0.640000 0.000000 0.640000 ( 0.644043)
54
- # chomp! 0.530000 0.000000 0.530000 ( 0.531415)
55
- # chop 0.620000 0.000000 0.620000 ( 0.624321)
56
- # chop! 0.500000 0.000000 0.500000 ( 0.509146)
57
- # strip 0.640000 0.000000 0.640000 ( 0.638785)
58
- # strip! 0.530000 0.000000 0.530000 ( 0.532196)
59
- # index 0.740000 0.000000 0.740000 ( 0.745742)
60
- # --------------------------------------------------- total: 4.200000sec
61
- #
62
- # user system total real
63
- # chomp 0.640000 0.010000 0.650000 ( 0.647287)
64
- # chomp! 0.530000 0.000000 0.530000 ( 0.532868)
65
- # chop 0.630000 0.000000 0.630000 ( 0.628236)
66
- # chop! 0.520000 0.000000 0.520000 ( 0.522950)
67
- # strip 0.640000 0.000000 0.640000 ( 0.646328)
68
- # strip! 0.520000 0.000000 0.520000 ( 0.532715)
69
- # index 0.740000 0.010000 0.750000 ( 0.771277)
70
-
71
- require 'rubygems'
72
- require 'tach'
73
-
74
- data = "Content-Length: 100\r\n"
75
- Tach.meter(1_000_000) do
76
- tach('chomp') do
77
- data.dup.chomp
78
- end
79
- tach('chomp!') do
80
- data.dup.chomp!
81
- end
82
- tach('chop') do
83
- data.dup.chop
84
- end
85
- tach('chop!') do
86
- data.dup.chop!
87
- end
88
- tach('strip') do
89
- data.dup.strip
90
- end
91
- tach('strip!') do
92
- data.dup.strip!
93
- end
94
- tach('index') do
95
- data.dup[0..-3]
96
- end
97
- end
98
-
99
- # +--------+----------+----------+
100
- # | tach | average | total |
101
- # +--------+----------+----------+
102
- # | chomp | 1.444547 | 1.444547 |
103
- # +--------+----------+----------+
104
- # | chomp! | 1.276813 | 1.276813 |
105
- # +--------+----------+----------+
106
- # | chop | 1.422744 | 1.422744 |
107
- # +--------+----------+----------+
108
- # | chop! | 1.240941 | 1.240941 |
109
- # +--------+----------+----------+
110
- # | strip | 1.444776 | 1.444776 |
111
- # +--------+----------+----------+
112
- # | strip! | 1.266459 | 1.266459 |
113
- # +--------+----------+----------+
114
- # | index | 1.557975 | 1.557975 |
115
- # +--------+----------+----------+
@@ -1,82 +0,0 @@
1
- require 'rubygems' if RUBY_VERSION < '1.9'
2
-
3
- require 'sinatra/base'
4
- require 'tach'
5
-
6
- require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'excon')
7
-
8
- module Excon
9
- class Server < Sinatra::Base
10
-
11
- def self.run
12
- Rack::Handler::WEBrick.run(
13
- Excon::Server.new,
14
- :Port => 9292,
15
- :AccessLog => [],
16
- :Logger => WEBrick::Log.new(nil, WEBrick::Log::ERROR)
17
- )
18
- end
19
-
20
- get '/data/:amount' do |amount|
21
- 'x' * amount.to_i
22
- end
23
-
24
- end
25
- end
26
-
27
- def with_server(&block)
28
- pid = Process.fork do
29
- Excon::Server.run
30
- end
31
- loop do
32
- sleep(1)
33
- begin
34
- Excon.get('http://localhost:9292/api/foo')
35
- break
36
- rescue
37
- end
38
- end
39
- yield
40
- ensure
41
- Process.kill(9, pid)
42
- end
43
-
44
- require 'net/http'
45
- require 'open-uri'
46
-
47
- url = 'http://localhost:9292/data/1000'
48
-
49
- with_server do
50
-
51
- Tach.meter(100) do
52
-
53
- tach('Excon') do
54
- Excon.get(url).body
55
- end
56
-
57
- # tach('Excon (persistent)') do |times|
58
- # excon = Excon.new(url)
59
- # times.times do
60
- # excon.request(:method => 'get').body
61
- # end
62
- # end
63
-
64
- tach('Net::HTTP') do
65
- # Net::HTTP.get('localhost', '/data/1000', 9292)
66
- Net::HTTP.start('localhost', 9292) {|http| http.get('/data/1000').body }
67
- end
68
-
69
- # tach('Net::HTTP (persistent)') do |times|
70
- # Net::HTTP.start('localhost', 9292) do |http|
71
- # times.times do
72
- # http.get('/data/1000').body
73
- # end
74
- # end
75
- # end
76
-
77
- # tach('open-uri') do
78
- # open(url).read
79
- # end
80
-
81
- end
82
- end