excon 1.3.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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: 1.3.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
@@ -53,48 +53,6 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: eventmachine
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 1.0.4
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 1.0.4
70
- - !ruby/object:Gem::Dependency
71
- name: json
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 1.8.5
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: 1.8.5
84
- - !ruby/object:Gem::Dependency
85
- name: open4
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
56
  - !ruby/object:Gem::Dependency
99
57
  name: puma
100
58
  requirement: !ruby/object:Gem::Requirement
@@ -231,7 +189,6 @@ files:
231
189
  - lib/excon/instrumentors/logging_instrumentor.rb
232
190
  - lib/excon/instrumentors/standard_instrumentor.rb
233
191
  - lib/excon/middlewares/base.rb
234
- - lib/excon/middlewares/capture_cookies.rb
235
192
  - lib/excon/middlewares/decompress.rb
236
193
  - lib/excon/middlewares/escape_path.rb
237
194
  - lib/excon/middlewares/expects.rb
@@ -241,14 +198,13 @@ files:
241
198
  - lib/excon/middlewares/redirect_follower.rb
242
199
  - lib/excon/middlewares/response_parser.rb
243
200
  - lib/excon/pretty_printer.rb
201
+ - lib/excon/resolver_factory.rb
244
202
  - lib/excon/response.rb
245
203
  - lib/excon/socket.rb
204
+ - lib/excon/socks5.rb
205
+ - lib/excon/socks5_socket.rb
206
+ - lib/excon/socks5_ssl_socket.rb
246
207
  - lib/excon/ssl_socket.rb
247
- - lib/excon/test/plugin/server/exec.rb
248
- - lib/excon/test/plugin/server/puma.rb
249
- - lib/excon/test/plugin/server/unicorn.rb
250
- - lib/excon/test/plugin/server/webrick.rb
251
- - lib/excon/test/server.rb
252
208
  - lib/excon/unix_socket.rb
253
209
  - lib/excon/utils.rb
254
210
  - lib/excon/version.rb
@@ -271,14 +227,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
227
  requirements:
272
228
  - - ">="
273
229
  - !ruby/object:Gem::Version
274
- version: 3.1.0
230
+ version: 3.3.0
275
231
  required_rubygems_version: !ruby/object:Gem::Requirement
276
232
  requirements:
277
233
  - - ">="
278
234
  - !ruby/object:Gem::Version
279
235
  version: '0'
280
236
  requirements: []
281
- rubygems_version: 3.6.9
237
+ rubygems_version: 4.0.3
282
238
  specification_version: 4
283
239
  summary: speed, persistence, http(s)
284
240
  test_files: []
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
- module Excon
3
- module Middleware
4
- class CaptureCookies < Excon::Middleware::Base
5
-
6
- def extract_cookies_from_set_cookie(set_cookie)
7
- set_cookie.split(',').map { |full| full.split(';').first.strip }.join('; ')
8
- end
9
-
10
- def get_header(datum, header)
11
- _, header_value = datum[:response][:headers].detect do |key, _|
12
- key.casecmp?(header)
13
- end
14
- header_value
15
- end
16
-
17
- def response_call(datum)
18
- cookie = get_header(datum, 'Set-Cookie')
19
- if cookie
20
- cookie = extract_cookies_from_set_cookie(cookie)
21
- unless datum[:headers].key?("Cookie")
22
- datum[:headers]["Cookie"] = cookie
23
- else
24
- original_cookies = datum[:headers]["Cookie"]
25
- datum[:headers]["Cookie"] = original_cookies.empty? ? cookie : [original_cookies,cookie].join('; ')
26
- end
27
- end
28
- super(datum)
29
- end
30
- end
31
- end
32
- end
@@ -1,26 +0,0 @@
1
- module Excon
2
- module Test
3
- module Plugin
4
- module Server
5
- module Exec
6
- def start(app_str = app)
7
- open_process(app_str)
8
- process_stderr = ""
9
- line = ''
10
- until line =~ /\Aready\Z/
11
- line = error.gets
12
- raise process_stderr if line.nil?
13
- process_stderr << line
14
- fatal_time = elapsed_time > timeout
15
- if fatal_time
16
- msg = "executable #{app_str} has taken too long to start"
17
- raise msg
18
- end
19
- end
20
- true
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,23 +0,0 @@
1
- module Excon
2
- module Test
3
- module Plugin
4
- module Server
5
- module Puma
6
- def start(app_str = app, bind_uri = bind)
7
- open_process(RbConfig.ruby, '-S', 'puma', '-b', bind_uri.to_s, app_str)
8
- process_stderr = ""
9
- line = ''
10
- until line.include?('Use Ctrl-C to stop')
11
- line = read.gets
12
- raise process_stderr if line.nil?
13
- process_stderr << line
14
- fatal_time = elapsed_time > timeout
15
- raise 'puma server has taken too long to start' if fatal_time
16
- end
17
- true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,40 +0,0 @@
1
- module Excon
2
- module Test
3
- module Plugin
4
- module Server
5
- module Unicorn
6
- def start(app_str = app, bind_uri = bind)
7
- bind_uri = URI.parse(bind_uri) unless bind_uri.is_a? URI::Generic
8
- is_unix_socket = (bind_uri.scheme == "unix")
9
- if is_unix_socket
10
- bind_str = bind_uri.to_s
11
- else
12
- host = bind_uri.host.gsub(/[\[\]]/, '')
13
- bind_str = "#{host}:#{bind_uri.port}"
14
- end
15
- args = [
16
- RbConfig.ruby,
17
- '-S',
18
- 'unicorn',
19
- '--no-default-middleware',
20
- '-l',
21
- bind_str,
22
- app_str
23
- ]
24
- open_process(*args)
25
- process_stderr = ''
26
- line = ''
27
- until line.include?('worker=0 ready')
28
- line = error.gets
29
- raise process_stderr if line.nil?
30
- process_stderr << line
31
- fatal_time = elapsed_time > timeout
32
- raise 'unicorn server has taken too long to start' if fatal_time
33
- end
34
- true
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,26 +0,0 @@
1
- module Excon
2
- module Test
3
- module Plugin
4
- module Server
5
- module Webrick
6
- def start(app_str = app, bind_uri = bind)
7
- bind_uri = URI.parse(bind_uri) unless bind_uri.is_a? URI::Generic
8
- host = bind_uri.host.gsub(/[\[\]]/, '')
9
- port = bind_uri.port.to_s
10
- open_process(RbConfig.ruby, '-S', 'rackup', '-s', 'webrick', '--host', host, '--port', port, app_str)
11
- process_stderr = ""
12
- line = ''
13
- until line.include?('HTTPServer#start')
14
- line = error.gets
15
- raise process_stderr if line.nil?
16
- process_stderr << line
17
- fatal_time = elapsed_time > timeout
18
- raise 'webrick server has taken too long to start' if fatal_time
19
- end
20
- true
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,99 +0,0 @@
1
- require 'open4'
2
- require 'excon'
3
- require 'excon/test/plugin/server/webrick'
4
- require 'excon/test/plugin/server/unicorn'
5
- require 'excon/test/plugin/server/puma'
6
- require 'excon/test/plugin/server/exec'
7
-
8
-
9
- module Excon
10
- module Test
11
- class Server
12
- attr_accessor :app, :server, :bind, :pid, :read, :write, :error, :started_at, :timeout
13
-
14
- # Methods that must be implemented by a plugin
15
- INSTANCE_REQUIRES = [:start]
16
-
17
- def initialize(args)
18
- # TODO: Validate these args
19
- @server = args.keys.first
20
- @app = args[server]
21
- args[:bind] ||= 'tcp://127.0.0.1:9292'
22
- @bind = URI.parse(args[:bind])
23
- @is_unix_socket = (@bind.scheme == 'unix')
24
- @bind.host = @bind.host.gsub(/[\[\]]/, '') unless @is_unix_socket
25
- if args[:timeout]
26
- @timeout = args[:timeout]
27
- else
28
- @timeout = 20
29
- end
30
- name = @server.to_s.split('_').collect(&:capitalize).join
31
- plug = nested_const_get("Excon::Test::Plugin::Server::#{name}")
32
- self.extend plug
33
- check_implementation(plug)
34
- end
35
-
36
- def open_process(*args)
37
- if RUBY_PLATFORM == 'java'
38
- @pid, @write, @read, @error = IO.popen4(*args)
39
- else
40
- @pid, @write, @read, @error = Open4.popen4(*args)
41
- end
42
- @started_at = Time.now
43
- end
44
-
45
- def elapsed_time
46
- Time.now - started_at
47
- end
48
-
49
- def stop
50
- if RUBY_PLATFORM == 'java'
51
- Process.kill('USR1', pid)
52
- else
53
- Process.kill('KILL', pid)
54
- Process.wait(pid)
55
- end
56
-
57
- if @is_unix_socket
58
- socket = @bind.path
59
- File.delete(socket) if File.exist?(socket)
60
- end
61
-
62
- # TODO: Ensure process is really dead
63
- dump_errors
64
- true
65
- end
66
- def dump_errors
67
- lines = error.read.split($/)
68
- while (line = lines.shift)
69
- case line
70
- when /(ERROR|Error)/
71
- unless line.match?(/(null cert chain|did not return a certificate|SSL_read:: internal error)/)
72
- in_err = true
73
- puts
74
- end
75
- when /^(127|localhost)/
76
- in_err = false
77
- end
78
- puts line if in_err
79
- end
80
- end
81
-
82
- private
83
-
84
- def nested_const_get(namespace)
85
- namespace.split('::').inject(Object) do |mod, klass|
86
- mod.const_get(klass)
87
- end
88
- end
89
-
90
- def check_implementation(plug)
91
- INSTANCE_REQUIRES.each do |m|
92
- unless self.respond_to? m
93
- raise "FATAL: #{plug} does not implement ##{m}"
94
- end
95
- end
96
- end
97
- end
98
- end
99
- end