excon 0.62.0 → 0.63.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 (54) hide show
  1. checksums.yaml +5 -5
  2. data/.github/stale.yml +17 -0
  3. data/.travis.yml +7 -19
  4. data/LICENSE.md +1 -1
  5. data/README.md +5 -4
  6. data/changelog.txt +25 -0
  7. data/data/cacert.pem +440 -994
  8. data/excon.gemspec +9 -0
  9. data/lib/excon.rb +9 -1
  10. data/lib/excon/connection.rb +52 -35
  11. data/lib/excon/constants.rb +33 -13
  12. data/lib/excon/error.rb +3 -0
  13. data/lib/excon/instrumentors/logging_instrumentor.rb +3 -14
  14. data/lib/excon/instrumentors/standard_instrumentor.rb +1 -8
  15. data/lib/excon/middlewares/base.rb +6 -0
  16. data/lib/excon/middlewares/expects.rb +6 -0
  17. data/lib/excon/middlewares/idempotent.rb +20 -3
  18. data/lib/excon/middlewares/instrumentor.rb +8 -0
  19. data/lib/excon/middlewares/mock.rb +8 -0
  20. data/lib/excon/middlewares/response_parser.rb +3 -0
  21. data/lib/excon/pretty_printer.rb +1 -8
  22. data/lib/excon/socket.rb +36 -10
  23. data/lib/excon/ssl_socket.rb +7 -0
  24. data/lib/excon/utils.rb +23 -4
  25. data/lib/excon/version.rb +1 -1
  26. data/spec/excon/test/server_spec.rb +2 -2
  27. data/spec/helpers/warning_helpers.rb +9 -0
  28. data/spec/requests/unix_socket_spec.rb +2 -10
  29. data/spec/requests/validation_spec.rb +80 -0
  30. data/spec/spec_helper.rb +2 -0
  31. data/spec/support/shared_contexts/test_stub_context.rb +11 -0
  32. data/spec/support/shared_examples/shared_example_for_clients.rb +6 -4
  33. data/tests/authorization_header_tests.rb +19 -21
  34. data/tests/bad_tests.rb +22 -0
  35. data/tests/batch_requests.rb +1 -1
  36. data/tests/complete_responses.rb +1 -1
  37. data/tests/data/127.0.0.1.cert.crt +15 -18
  38. data/tests/data/127.0.0.1.cert.key +28 -27
  39. data/tests/data/excon.cert.crt +15 -18
  40. data/tests/data/excon.cert.key +28 -27
  41. data/tests/error_tests.rb +1 -1
  42. data/tests/instrumentors/logging_instrumentor_tests.rb +28 -0
  43. data/tests/middlewares/decompress_tests.rb +1 -1
  44. data/tests/middlewares/idempotent_tests.rb +56 -17
  45. data/tests/middlewares/mock_tests.rb +2 -2
  46. data/tests/pipeline_tests.rb +1 -1
  47. data/tests/request_tests.rb +5 -6
  48. data/tests/response_tests.rb +1 -1
  49. data/tests/servers/bad.rb +5 -0
  50. data/tests/servers/good.rb +0 -8
  51. data/tests/servers/good_ipv4.rb +8 -0
  52. data/tests/servers/good_ipv6.rb +8 -0
  53. data/tests/test_helper.rb +27 -36
  54. metadata +17 -5
@@ -2,6 +2,28 @@ Shindo.tests('Excon bad server interaction') do
2
2
 
3
3
  with_server('bad') do
4
4
 
5
+ tests('header splitting') do
6
+
7
+ tests('prevents key splitting').raises(Excon::Errors::InvalidHeaderKey) do
8
+ connection = Excon.new('http://127.0.0.1:9292')
9
+ connection.request(
10
+ headers: { "Foo\r\nBar" => "baz" },
11
+ method: :get,
12
+ path: '/echo'
13
+ )
14
+ end
15
+
16
+ tests('prevents value splitting').raises(Excon::Errors::InvalidHeaderValue) do
17
+ connection = Excon.new('http://127.0.0.1:9292')
18
+ connection.request(
19
+ headers: { Foo: "bar\r\nBaz: qux" },
20
+ method: :get,
21
+ path: '/echo'
22
+ )
23
+ end
24
+
25
+ end
26
+
5
27
  tests('bad server: causes EOFError') do
6
28
 
7
29
  tests('with no content length and no chunking') do
@@ -1,7 +1,7 @@
1
1
  require 'shindo'
2
2
 
3
3
  Shindo.tests('Batch Requests') do
4
- with_server('good') do
4
+ with_server('good_ipv4') do
5
5
  tests('with batch request size 2') do
6
6
  returns(%w{ 1 2 1 2 }, 'batch request size 2') do
7
7
  connection = Excon.new('http://127.0.0.1:9292')
@@ -1,7 +1,7 @@
1
1
  Shindo.tests('Excon Response Validation') do
2
2
  env_init
3
3
 
4
- with_server('good') do
4
+ with_server('good_ipv4') do
5
5
  tests('good responses with complete headers') do
6
6
  100.times do
7
7
  res = Excon.get('http://127.0.0.1:9292/chunked/simple')
@@ -1,20 +1,17 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDUjCCAjqgAwIBAgIJAMw/PAoBSqk8MA0GCSqGSIb3DQEBCwUAMCQxEjAQBgNV
3
- BAMTCTEyNy4wLjAuMTEOMAwGA1UEChMFZXhjb24wHhcNMTcwOTA1MTk0MzMwWhcN
4
- MTgwOTA1MTk0MzMwWjAkMRIwEAYDVQQDEwkxMjcuMC4wLjExDjAMBgNVBAoTBWV4
5
- Y29uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/PbsbAxwowMioOR4
6
- UGR/tDF4ul6TZSKtiYxYqe+xEhlgLzS7/9mQibkJAz2EKNNd+DR8XnkvB84WNWyL
7
- DNeq1de3vZCgmN9W1oddoxbhNGKLSN6KmBxANaJzpbYHBHKJhErqGYeBoBf135UF
8
- 2hVh7oU9n4P5ozdnjpx3IlNh6coDwNmuGkpfGftL2UbOZOBuXM7E0mtOlTUTg3OF
9
- tvITBcXf1iFNcLI9KrtEkvVsC3iHEis83y0V4sPSPxl+UYJI44XowjIQ9hxs2616
10
- GvITep2m/ydTnjwu/wn5OSnyNNRV+jEYzDfCSQ7MZxoLDm05RVRZJY1hJwizaP7N
11
- a2pNuQIDAQABo4GGMIGDMB0GA1UdDgQWBBRdlYAjIjj58kiqr2bDwUxdsIPgMzBU
12
- BgNVHSMETTBLgBRdlYAjIjj58kiqr2bDwUxdsIPgM6EopCYwJDESMBAGA1UEAxMJ
13
- MTI3LjAuMC4xMQ4wDAYDVQQKEwVleGNvboIJAMw/PAoBSqk8MAwGA1UdEwQFMAMB
14
- Af8wDQYJKoZIhvcNAQELBQADggEBAIN1e6jRgMI/PD/F5nMgZJZ5Zv9hPu8ID1v3
15
- Efy7hkNS7KXWLXLRbw9HVBscrNGDmX2l0oqx6WSjn6n8yFFMlI+zWAUZjuF+8PjC
16
- fa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request/response debugging') do
35
35
  Excon.new('http://localhost', path: "foo\r\nbar: baz")
36
36
  false
37
37
  rescue => err
38
- err.to_s.include? "foo\r\nbar: baz"
38
+ err.to_s.include?(RUBY_VERSION >= '2.6.0' ? 'foo\r\nbar: baz' : "foo\r\nbar: baz")
39
39
  end
40
40
  end
41
41
 
@@ -0,0 +1,28 @@
1
+ require 'logger'
2
+
3
+ Shindo.tests('logging instrumentor') do
4
+ env_init
5
+
6
+ tests("connection logger").returns(true) do
7
+ Excon.stub({:method => :get}, {body: 'body', status: 200})
8
+
9
+ log_path = "/tmp/excon_#{Time.now.to_i}.txt"
10
+ logger = Logger.new(log_path)
11
+ # omit datetime to simplify test matcher
12
+ logger.formatter = proc do |severity, datetime, progname, msg|
13
+ "#{msg}\n"
14
+ end
15
+
16
+ connection = Excon.new(
17
+ 'http://127.0.0.1:9292',
18
+ instrumentor: Excon::LoggingInstrumentor,
19
+ logger: logger,
20
+ mock: true
21
+ )
22
+ response = connection.request(method: :get, path: '/logger')
23
+ File.readlines(log_path)[1..2] == [
24
+ "request: http://127.0.0.1/logger\n",
25
+ "response: body\n"
26
+ ]
27
+ end
28
+ end
@@ -1,7 +1,7 @@
1
1
  Shindo.tests('Excon Decompress Middleware') do
2
2
  env_init
3
3
 
4
- with_server('good') do
4
+ with_server('good_ipv4') do
5
5
 
6
6
  before do
7
7
  @connection ||= Excon.new(
@@ -9,12 +9,12 @@ Shindo.tests('Excon request idempotencey') do
9
9
  Excon.stubs.clear
10
10
  end
11
11
 
12
- tests("Non-idempotent call with an erroring socket").raises(Excon::Errors::SocketError) do
12
+ tests("Non-idempotent call with an erroring socket").raises(Excon::Error::Socket) do
13
13
  run_count = 0
14
14
  Excon.stub({:method => :get}) { |params|
15
15
  run_count += 1
16
16
  if run_count <= 3 # First 3 calls fail.
17
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
17
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
18
18
  else
19
19
  {:body => params[:body], :headers => params[:headers], :status => 200}
20
20
  end
@@ -28,7 +28,7 @@ Shindo.tests('Excon request idempotencey') do
28
28
  Excon.stub({:method => :get}) { |params|
29
29
  run_count += 1
30
30
  if run_count <= 3 # First 3 calls fail.
31
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
31
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
32
32
  else
33
33
  {:body => params[:body], :headers => params[:headers], :status => 200}
34
34
  end
@@ -38,12 +38,12 @@ Shindo.tests('Excon request idempotencey') do
38
38
  response.status
39
39
  end
40
40
 
41
- tests("Idempotent request with socket erroring first 5 times").raises(Excon::Errors::SocketError) do
41
+ tests("Idempotent request with socket erroring first 5 times").raises(Excon::Error::Socket) do
42
42
  run_count = 0
43
43
  Excon.stub({:method => :get}) { |params|
44
44
  run_count += 1
45
45
  if run_count <= 5 # First 5 calls fail.
46
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
46
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
47
47
  else
48
48
  {:body => params[:body], :headers => params[:headers], :status => 200}
49
49
  end
@@ -58,7 +58,7 @@ Shindo.tests('Excon request idempotencey') do
58
58
  Excon.stub({:method => :get}) { |params|
59
59
  run_count += 1
60
60
  if run_count <= 1 # First call fails.
61
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
61
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
62
62
  else
63
63
  {:body => params[:body], :headers => params[:headers], :status => 200}
64
64
  end
@@ -68,12 +68,12 @@ Shindo.tests('Excon request idempotencey') do
68
68
  response.status
69
69
  end
70
70
 
71
- tests("Lowered retry limit with socket erroring first 3 times").raises(Excon::Errors::SocketError) do
71
+ tests("Lowered retry limit with socket erroring first 3 times").raises(Excon::Error::Socket) do
72
72
  run_count = 0
73
73
  Excon.stub({:method => :get}) { |params|
74
74
  run_count += 1
75
75
  if run_count <= 3 # First 3 calls fail.
76
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
76
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
77
77
  else
78
78
  {:body => params[:body], :headers => params[:headers], :status => 200}
79
79
  end
@@ -88,7 +88,7 @@ Shindo.tests('Excon request idempotencey') do
88
88
  Excon.stub({:method => :get}) { |params|
89
89
  run_count += 1
90
90
  if run_count <= 5 # First 5 calls fail.
91
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
91
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
92
92
  else
93
93
  {:body => params[:body], :headers => params[:headers], :status => 200}
94
94
  end
@@ -98,12 +98,12 @@ Shindo.tests('Excon request idempotencey') do
98
98
  response.status
99
99
  end
100
100
 
101
- tests("Raised retry limit with socket erroring first 9 times").raises(Excon::Errors::SocketError) do
101
+ tests("Raised retry limit with socket erroring first 9 times").raises(Excon::Error::Socket) do
102
102
  run_count = 0
103
103
  Excon.stub({:method => :get}) { |params|
104
104
  run_count += 1
105
105
  if run_count <= 9 # First 9 calls fail.
106
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
106
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
107
107
  else
108
108
  {:body => params[:body], :headers => params[:headers], :status => 200}
109
109
  end
@@ -118,7 +118,7 @@ Shindo.tests('Excon request idempotencey') do
118
118
  Excon.stub({:method => :get}) { |params|
119
119
  run_count += 1
120
120
  if run_count <= 5 # First 5 calls fail.
121
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
121
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
122
122
  else
123
123
  {:body => params[:body], :headers => params[:headers], :status => 200}
124
124
  end
@@ -133,7 +133,7 @@ Shindo.tests('Excon request idempotencey') do
133
133
  Excon.stub({:method => :get}) { |params|
134
134
  run_count += 1
135
135
  if run_count <= 2 # First 5 calls fail.
136
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
136
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
137
137
  else
138
138
  {:body => params[:body], :headers => params[:headers], :status => 200}
139
139
  end
@@ -145,12 +145,12 @@ Shindo.tests('Excon request idempotencey') do
145
145
  response.status
146
146
  end
147
147
 
148
- tests("Retry limit and sleep in constructor with socket erroring first 2 times").raises(Excon::Errors::SocketError) do
148
+ tests("Retry limit and sleep in constructor with socket erroring first 2 times").raises(Excon::Error::Socket) do
149
149
  run_count = 0
150
150
  Excon.stub({:method => :get}) { |params|
151
151
  run_count += 1
152
152
  if run_count <= 2 # First 5 calls fail.
153
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
153
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
154
154
  else
155
155
  {:body => params[:body], :headers => params[:headers], :status => 200}
156
156
  end
@@ -161,6 +161,45 @@ Shindo.tests('Excon request idempotencey') do
161
161
  response.status
162
162
  end
163
163
 
164
+ tests("Idempotent request with custom error first 3 times").returns(200) do
165
+ run_count = 0
166
+ Excon.stub({:method => :get}) { |params|
167
+ run_count += 1
168
+ if run_count <= 3 # First 3 calls fail.
169
+ raise "oops"
170
+ else
171
+ {:body => params[:body], :headers => params[:headers], :status => 200}
172
+ end
173
+ }
174
+
175
+ response = @connection.request(:method => :get, :idempotent => true, :retry_errors => [RuntimeError], :path => '/some-path')
176
+ response.status
177
+ end
178
+
179
+ tests("Idempotent request with custom error first 5 times").raises(RuntimeError) do
180
+ run_count = 0
181
+ Excon.stub({:method => :get}) { |params|
182
+ run_count += 1
183
+ if run_count <= 5 # First 5 calls fail.
184
+ raise "oops"
185
+ else
186
+ {:body => params[:body], :headers => params[:headers], :status => 200}
187
+ end
188
+ }
189
+
190
+ response = @connection.request(:method => :get, :idempotent => true, :retry_errors => [RuntimeError], :path => '/some-path')
191
+ response.status
192
+ end
193
+
194
+ tests("Overriding default retry_errors").raises(Excon::Error::Socket) do
195
+ Excon.stub({:method => :get}) { |params|
196
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
197
+ }
198
+
199
+ response = @connection.request(:method => :get, :idempotent => true, :retry_errors => [RuntimeError], :path => '/some-path')
200
+ response.status
201
+ end
202
+
164
203
  class Block
165
204
  attr_reader :rewound
166
205
  def initialize
@@ -178,7 +217,7 @@ Shindo.tests('Excon request idempotencey') do
178
217
  Excon.stub({:method => :get}) { |params|
179
218
  run_count += 1
180
219
  if run_count <= 1 # First call fails.
181
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
220
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
182
221
  else
183
222
  {:body => params[:body], :headers => params[:headers], :status => 200}
184
223
  end
@@ -193,7 +232,7 @@ Shindo.tests('Excon request idempotencey') do
193
232
  Excon.stub({:method => :get}) { |params|
194
233
  run_count += 1
195
234
  if run_count <= 1 # First call fails.
196
- raise Excon::Errors::SocketError.new(Exception.new "Mock Error")
235
+ raise Excon::Error::Socket.new(Exception.new "Mock Error")
197
236
  else
198
237
  {:body => params[:body], :headers => params[:headers], :status => 200}
199
238
  end