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.
- checksums.yaml +5 -5
- data/.github/stale.yml +17 -0
- data/.travis.yml +7 -19
- data/LICENSE.md +1 -1
- data/README.md +5 -4
- data/changelog.txt +25 -0
- data/data/cacert.pem +440 -994
- data/excon.gemspec +9 -0
- data/lib/excon.rb +9 -1
- data/lib/excon/connection.rb +52 -35
- data/lib/excon/constants.rb +33 -13
- data/lib/excon/error.rb +3 -0
- data/lib/excon/instrumentors/logging_instrumentor.rb +3 -14
- data/lib/excon/instrumentors/standard_instrumentor.rb +1 -8
- data/lib/excon/middlewares/base.rb +6 -0
- data/lib/excon/middlewares/expects.rb +6 -0
- data/lib/excon/middlewares/idempotent.rb +20 -3
- data/lib/excon/middlewares/instrumentor.rb +8 -0
- data/lib/excon/middlewares/mock.rb +8 -0
- data/lib/excon/middlewares/response_parser.rb +3 -0
- data/lib/excon/pretty_printer.rb +1 -8
- data/lib/excon/socket.rb +36 -10
- data/lib/excon/ssl_socket.rb +7 -0
- data/lib/excon/utils.rb +23 -4
- data/lib/excon/version.rb +1 -1
- data/spec/excon/test/server_spec.rb +2 -2
- data/spec/helpers/warning_helpers.rb +9 -0
- data/spec/requests/unix_socket_spec.rb +2 -10
- data/spec/requests/validation_spec.rb +80 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_contexts/test_stub_context.rb +11 -0
- data/spec/support/shared_examples/shared_example_for_clients.rb +6 -4
- data/tests/authorization_header_tests.rb +19 -21
- data/tests/bad_tests.rb +22 -0
- data/tests/batch_requests.rb +1 -1
- data/tests/complete_responses.rb +1 -1
- data/tests/data/127.0.0.1.cert.crt +15 -18
- data/tests/data/127.0.0.1.cert.key +28 -27
- data/tests/data/excon.cert.crt +15 -18
- data/tests/data/excon.cert.key +28 -27
- data/tests/error_tests.rb +1 -1
- data/tests/instrumentors/logging_instrumentor_tests.rb +28 -0
- data/tests/middlewares/decompress_tests.rb +1 -1
- data/tests/middlewares/idempotent_tests.rb +56 -17
- data/tests/middlewares/mock_tests.rb +2 -2
- data/tests/pipeline_tests.rb +1 -1
- data/tests/request_tests.rb +5 -6
- data/tests/response_tests.rb +1 -1
- data/tests/servers/bad.rb +5 -0
- data/tests/servers/good.rb +0 -8
- data/tests/servers/good_ipv4.rb +8 -0
- data/tests/servers/good_ipv6.rb +8 -0
- data/tests/test_helper.rb +27 -36
- metadata +17 -5
@@ -96,7 +96,7 @@ Shindo.tests('Excon stubs') do
|
|
96
96
|
response.body
|
97
97
|
end
|
98
98
|
|
99
|
-
tests('response.headers').returns({'Host' => '127.0.0.1:9292', 'User-Agent' => "excon/#{Excon::VERSION}"}) do
|
99
|
+
tests('response.headers').returns({'Accept' => '*/*', 'Host' => '127.0.0.1:9292', 'User-Agent' => "excon/#{Excon::VERSION}"}) do
|
100
100
|
response.headers
|
101
101
|
end
|
102
102
|
|
@@ -153,7 +153,7 @@ Shindo.tests('Excon stubs') do
|
|
153
153
|
Excon.get('http://127.0.0.1:9292/', :mock => true)
|
154
154
|
end
|
155
155
|
|
156
|
-
with_server('
|
156
|
+
with_server('good_ipv4') do
|
157
157
|
tests('allow mismatched stub').returns(200) do
|
158
158
|
Excon.stub({:path => '/echo/request_count'}, {:body => 'body'})
|
159
159
|
Excon.get(
|
data/tests/pipeline_tests.rb
CHANGED
data/tests/request_tests.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
Shindo.tests('Request Tests') do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
ip_ports.each do |ip_port|
|
2
|
+
tests('persistent connections') do
|
3
|
+
ip_ports = [['127.0.0.1:9292', 'good_ipv4']]
|
4
|
+
ip_ports << ['[::1]:9293', 'good_ipv6'] unless RUBY_PLATFORM == 'java'
|
5
|
+
ip_ports.each do |ip_port, server|
|
6
|
+
with_server(server) do
|
8
7
|
|
9
8
|
tests("with default :persistent => true, #{ip_port}") do
|
10
9
|
connection = nil
|
data/tests/response_tests.rb
CHANGED
data/tests/servers/bad.rb
CHANGED
@@ -5,6 +5,11 @@ require "eventmachine"
|
|
5
5
|
module BadServer
|
6
6
|
def receive_data(data)
|
7
7
|
case data
|
8
|
+
when %r{^GET /echo\s}
|
9
|
+
send_data "HTTP/1.1 200 OK\r\n"
|
10
|
+
send_data "\r\n"
|
11
|
+
send_data data
|
12
|
+
close_connection(true)
|
8
13
|
when %r{^GET /eof/no_content_length_and_no_chunking\s}
|
9
14
|
send_data "HTTP/1.1 200 OK\r\n"
|
10
15
|
send_data "\r\n"
|
data/tests/servers/good.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'eventmachine'
|
4
2
|
require 'stringio'
|
5
3
|
require 'uri'
|
@@ -342,9 +340,3 @@ module GoodServer
|
|
342
340
|
(?:,\s*|\Z)'xn).flatten
|
343
341
|
end
|
344
342
|
end
|
345
|
-
|
346
|
-
EM.run do
|
347
|
-
EM.start_server("127.0.0.1", 9292, GoodServer)
|
348
|
-
EM.start_server("::1", 9293, GoodServer) unless RUBY_PLATFORM == 'java'
|
349
|
-
$stderr.puts "ready"
|
350
|
-
end
|
data/tests/test_helper.rb
CHANGED
@@ -4,11 +4,14 @@ require 'excon'
|
|
4
4
|
require 'delorean'
|
5
5
|
require 'open4'
|
6
6
|
|
7
|
+
require './spec/helpers/warning_helpers.rb'
|
8
|
+
|
7
9
|
Excon.defaults.merge!(
|
8
10
|
:connect_timeout => 5,
|
9
11
|
:read_timeout => 5,
|
10
12
|
:write_timeout => 5
|
11
13
|
)
|
14
|
+
Excon.set_raise_on_warnings!(true)
|
12
15
|
|
13
16
|
def basic_tests(url = 'http://127.0.0.1:9292', options = {})
|
14
17
|
([true, false] * 2).combination(2).to_a.uniq.each do |nonblock, persistent|
|
@@ -211,14 +214,6 @@ def env_stack
|
|
211
214
|
@env_stack ||= []
|
212
215
|
end
|
213
216
|
|
214
|
-
def silence_warnings
|
215
|
-
orig_verbose = $VERBOSE
|
216
|
-
$VERBOSE = nil
|
217
|
-
yield
|
218
|
-
ensure
|
219
|
-
$VERBOSE = orig_verbose
|
220
|
-
end
|
221
|
-
|
222
217
|
def capture_response_block
|
223
218
|
captures = []
|
224
219
|
yield lambda {|chunk, remaining_bytes, total_bytes|
|
@@ -227,25 +222,34 @@ def capture_response_block
|
|
227
222
|
captures
|
228
223
|
end
|
229
224
|
|
230
|
-
def
|
231
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'rackups', *parts))
|
232
|
-
end
|
233
|
-
|
234
|
-
def with_rackup(name, host="127.0.0.1")
|
225
|
+
def launch_process(*args)
|
235
226
|
unless RUBY_PLATFORM == 'java'
|
236
227
|
GC.disable if RUBY_VERSION < '1.9'
|
237
|
-
pid, w, r, e = Open4.popen4(
|
228
|
+
pid, w, r, e = Open4.popen4(*args)
|
238
229
|
else
|
239
|
-
pid, w, r, e = IO.popen4(
|
230
|
+
pid, w, r, e = IO.popen4(*args)
|
240
231
|
end
|
241
|
-
|
242
|
-
|
243
|
-
|
232
|
+
return pid, w, r, e
|
233
|
+
end
|
234
|
+
|
235
|
+
def cleanup_process(pid)
|
244
236
|
Process.kill(9, pid)
|
245
237
|
unless RUBY_PLATFORM == 'java'
|
246
238
|
GC.enable if RUBY_VERSION < '1.9'
|
247
239
|
Process.wait(pid)
|
248
240
|
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def rackup_path(*parts)
|
244
|
+
File.expand_path(File.join(File.dirname(__FILE__), 'rackups', *parts))
|
245
|
+
end
|
246
|
+
|
247
|
+
def with_rackup(name, host="127.0.0.1")
|
248
|
+
pid, w, r, e = launch_process("rackup", "-s", "webrick", "--host", host, rackup_path(name))
|
249
|
+
until e.gets =~ /HTTPServer#start:/; end
|
250
|
+
yield
|
251
|
+
ensure
|
252
|
+
cleanup_process(pid)
|
249
253
|
|
250
254
|
# dump server errors
|
251
255
|
lines = e.read.split($/)
|
@@ -265,20 +269,16 @@ end
|
|
265
269
|
|
266
270
|
def with_unicorn(name, listen='127.0.0.1:9292')
|
267
271
|
unless RUBY_PLATFORM == 'java'
|
268
|
-
GC.disable if RUBY_VERSION < '1.9'
|
269
272
|
unix_socket = listen.sub('unix://', '') if listen.start_with? 'unix://'
|
270
|
-
pid, w, r, e =
|
273
|
+
pid, w, r, e = launch_process("unicorn", "--no-default-middleware","-l", listen, rackup_path(name))
|
271
274
|
until e.gets =~ /worker=0 ready/; end
|
272
275
|
else
|
273
276
|
# need to find suitable server for jruby
|
274
277
|
end
|
275
278
|
yield
|
276
279
|
ensure
|
277
|
-
|
278
|
-
|
279
|
-
GC.enable if RUBY_VERSION < '1.9'
|
280
|
-
Process.wait(pid)
|
281
|
-
end
|
280
|
+
cleanup_process(pid)
|
281
|
+
|
282
282
|
if not unix_socket.nil? and File.exist?(unix_socket)
|
283
283
|
File.delete(unix_socket)
|
284
284
|
end
|
@@ -289,18 +289,9 @@ def server_path(*parts)
|
|
289
289
|
end
|
290
290
|
|
291
291
|
def with_server(name)
|
292
|
-
|
293
|
-
GC.disable if RUBY_VERSION < '1.9'
|
294
|
-
pid, w, r, e = Open4.popen4(server_path("#{name}.rb"))
|
295
|
-
else
|
296
|
-
pid, w, r, e = IO.popen4(server_path("#{name}.rb"))
|
297
|
-
end
|
292
|
+
pid, w, r, e = launch_process("ruby", server_path("#{name}.rb"))
|
298
293
|
until e.gets =~ /ready/; end
|
299
294
|
yield
|
300
295
|
ensure
|
301
|
-
|
302
|
-
unless RUBY_PLATFORM == 'java'
|
303
|
-
GC.enable if RUBY_VERSION < '1.9'
|
304
|
-
Process.wait(pid)
|
305
|
-
end
|
296
|
+
cleanup_process(pid)
|
306
297
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.63.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dpiddy (Dan Peterson)
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2019-04-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -190,6 +190,7 @@ extra_rdoc_files:
|
|
190
190
|
- CONTRIBUTING.md
|
191
191
|
files:
|
192
192
|
- ".document"
|
193
|
+
- ".github/stale.yml"
|
193
194
|
- ".gitignore"
|
194
195
|
- ".rspec"
|
195
196
|
- ".travis.yml"
|
@@ -254,11 +255,14 @@ files:
|
|
254
255
|
- spec/excon/test/server_spec.rb
|
255
256
|
- spec/excon_spec.rb
|
256
257
|
- spec/helpers/file_path_helpers.rb
|
258
|
+
- spec/helpers/warning_helpers.rb
|
257
259
|
- spec/requests/basic_spec.rb
|
258
260
|
- spec/requests/eof_requests_spec.rb
|
259
261
|
- spec/requests/unix_socket_spec.rb
|
262
|
+
- spec/requests/validation_spec.rb
|
260
263
|
- spec/spec_helper.rb
|
261
264
|
- spec/support/shared_contexts/test_server_context.rb
|
265
|
+
- spec/support/shared_contexts/test_stub_context.rb
|
262
266
|
- spec/support/shared_examples/shared_example_for_clients.rb
|
263
267
|
- spec/support/shared_examples/shared_example_for_streaming_clients.rb
|
264
268
|
- spec/support/shared_examples/shared_example_for_test_servers.rb
|
@@ -274,6 +278,7 @@ files:
|
|
274
278
|
- tests/data/xs
|
275
279
|
- tests/error_tests.rb
|
276
280
|
- tests/header_tests.rb
|
281
|
+
- tests/instrumentors/logging_instrumentor_tests.rb
|
277
282
|
- tests/middlewares/canned_response_tests.rb
|
278
283
|
- tests/middlewares/capture_cookies_tests.rb
|
279
284
|
- tests/middlewares/decompress_tests.rb
|
@@ -311,6 +316,8 @@ files:
|
|
311
316
|
- tests/servers/eof.rb
|
312
317
|
- tests/servers/error.rb
|
313
318
|
- tests/servers/good.rb
|
319
|
+
- tests/servers/good_ipv4.rb
|
320
|
+
- tests/servers/good_ipv6.rb
|
314
321
|
- tests/test_helper.rb
|
315
322
|
- tests/thread_safety_tests.rb
|
316
323
|
- tests/timeout_tests.rb
|
@@ -318,7 +325,13 @@ files:
|
|
318
325
|
homepage: https://github.com/excon/excon
|
319
326
|
licenses:
|
320
327
|
- MIT
|
321
|
-
metadata:
|
328
|
+
metadata:
|
329
|
+
homepage_uri: https://github.com/excon/excon
|
330
|
+
bug_tracker_uri: https://github.com/excon/excon/issues
|
331
|
+
changelog_uri: https://github.com/excon/excon/blob/master/changelog.txt
|
332
|
+
documentation_uri: https://github.com/excon/excon/blob/master/README.md
|
333
|
+
source_code_uri: https://github.com/excon/excon
|
334
|
+
wiki_uri: https://github.com/excon/excon/wiki
|
322
335
|
post_install_message:
|
323
336
|
rdoc_options:
|
324
337
|
- "--charset=UTF-8"
|
@@ -335,8 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
348
|
- !ruby/object:Gem::Version
|
336
349
|
version: '0'
|
337
350
|
requirements: []
|
338
|
-
|
339
|
-
rubygems_version: 2.6.13
|
351
|
+
rubygems_version: 3.0.2
|
340
352
|
signing_key:
|
341
353
|
specification_version: 4
|
342
354
|
summary: speed, persistence, http(s)
|